actually apply limits everywhere

This commit is contained in:
vabene1111
2021-06-04 17:05:03 +02:00
parent bfe72210df
commit 388ef32475
4 changed files with 29 additions and 4 deletions

View File

@ -28,7 +28,7 @@ class RecipeCreate(GroupRequiredMixin, CreateView):
fields = ('name',)
def form_valid(self, form):
if self.request.space.max_recipes != 0 and Recipe.objects.filter(space=self.request.space).count() >= self.request.space.max_recipes:
if self.request.space.max_recipes != 0 and Recipe.objects.filter(space=self.request.space).count() >= self.request.space.max_recipes: # TODO move to central helper function
messages.add_message(self.request, messages.WARNING, _('You have reached the maximum number of recipes for your space.'))
return HttpResponseRedirect(reverse('index'))