Automodere profile files

This commit is contained in:
Skia 2017-03-24 08:43:13 +01:00
parent e56b2476b7
commit d2da5716ba

View File

@ -167,7 +167,8 @@ class UserProfileForm(forms.ModelForm):
im = Image.open(BytesIO(f.read())) im = Image.open(BytesIO(f.read()))
new_file = SithFile(parent=parent, name=self.generate_name(field, f), new_file = SithFile(parent=parent, name=self.generate_name(field, f),
file=resize_image(im, 400, f.content_type.split('/')[-1]), file=resize_image(im, 400, f.content_type.split('/')[-1]),
owner=self.instance, is_folder=False, mime_type=f.content_type, size=f._size) owner=self.instance, is_folder=False, mime_type=f.content_type, size=f._size,
moderator=self.instance, is_moderated=True)
new_file.file.name = new_file.name new_file.file.name = new_file.name
old = SithFile.objects.filter(parent=parent, name=new_file.name).first() old = SithFile.objects.filter(parent=parent, name=new_file.name).first()
if old: if old: