Commits

Guilherme Gondim committed e4bf09f

minor refactoring

  • Participants
  • Parent commits a507014

Comments (0)

Files changed (2)

File galeria/forms.py

 
         for filename in zfile.namelist():
             title = os.path.basename(os.path.splitext(filename)[0])
-            slug = slug=slugify(title)
+            slug = slugify(title)
             picture = Picture(title=title, slug=slug, is_public=False, album=album)
             try:
                 content = zfile.read(filename)
                 picture_list.append(picture)
 
         return picture_list
-
-    def save(self):
-        picture_list = self.process_zip_archive()
-        Picture.objects.bulk_create(picture_list)

File galeria/views.py

     if request.method == 'POST':
         form = ZipUploadForm(request.POST, request.FILES)
         if form.is_valid():
-            form.save()
+            picture_list = form.process_zip_archive()
+            Picture.objects.bulk_create(picture_list)
 
             # Send user to album change view to edit the uploaded pictures
             album = form.cleaned_data['album']