fix: 📄 restrict recipes when editing posts
This commit is contained in:
parent
745a2d188b
commit
4757e4bb7a
1 changed files with 5 additions and 1 deletions
|
|
@ -81,7 +81,11 @@ class EditPostview(LoginRequiredMixin, UserPassesTestMixin, FormView):
|
|||
}
|
||||
|
||||
def get_form(self):
|
||||
return self.form_class(instance=self.post_object, **self.get_form_kwargs())
|
||||
form = self.form_class(instance=self.post_object, **self.get_form_kwargs())
|
||||
form.fields["recipe"].queryset = Recipe.objects.filter(
|
||||
created_by=self.request.user
|
||||
)
|
||||
return form
|
||||
|
||||
@cached_property
|
||||
def post_object(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue