Compare commits

...

3 commits

Author SHA1 Message Date
Bastien Roy
f71410e9f0 Merge branch 'feature/166/rendre-telephone-non-obligatoire' into 'develop'
[166] Rendre le telephone non obligatoire

Closes #166

See merge request la-chariotte/la-chariotte!108
2024-10-25 09:32:56 +00:00
xmeunier
44a2c20f95 Simpler solution to prevent unitended OrderAuthor 2024-10-20 15:06:10 +02:00
mobilinux
84dadd9147 Prevent inintended creation of OrderAuthor before ordering
When a grouped_order_detail view was called with authenticated user,
when prefilling the firstName, lastName and email also inserted a new
OrderAuthor object in the database.
Now use SimpleNamespace, instead of OrderAuthor object, to carry
those values to the template.
2024-10-20 12:50:55 +00:00

View file

@ -119,12 +119,11 @@ class GroupedOrderDetailView(generic.DetailView):
prices_dict = {item.id: item.price for item in items}
if self.request.user.is_authenticated:
order_author = OrderAuthor.objects.create(
order_author = OrderAuthor(
first_name=self.request.user.first_name,
last_name=self.request.user.last_name,
email=self.request.user.username,
)
order_author.save()
else:
order_author = None