예제 #1
0
파일: views.py 프로젝트: 32x32/fufufuu
    def post(self, request):
        if not SiteSetting.as_dict().get(SiteSettingKey.ENABLE_UPLOADS):
            return redirect('upload.list')

        if self.get_upload_slots_used() > request.user.upload_limit:
            messages.error(request, _('You have reached your limit of {} uploads within the past 24 hours.').format(request.user.upload_limit))
            return redirect('upload.list')

        manga = Manga()
        manga.save(updated_by=request.user)
        return redirect('manga.edit.images', id=manga.id, slug=manga.slug)
예제 #2
0
 def test_manga_delete_draft(self):
     manga = Manga(status=MangaStatus.DRAFT)
     manga.save(updated_by=self.user)
     manga.delete()
     self.assertFalse(Manga.all.filter(id=manga.id).exists())
예제 #3
0
 def test_manga_save_slugify(self):
     manga = Manga(title='Some Brand New Title')
     manga.save(updated_by=self.user)
     self.assertEqual(manga.slug, 'some-brand-new-title')