fix adpin.py and views.py order variables

This commit is contained in:
Argiris Deligiannidis 2023-08-10 17:49:24 +00:00
parent 1478768bfb
commit 6bba69f38c
4 changed files with 4 additions and 4 deletions

View File

@ -40,10 +40,10 @@ class OrderAdmin(admin.ModelAdmin):
return "\n".join([str(p) for p in obj.order_products.all()]) return "\n".join([str(p) for p in obj.order_products.all()])
def get_customer_name(self, obj): def get_customer_name(self, obj):
return obj.customer.name return obj.customer_name
def get_customer_telephone(self, obj): def get_customer_telephone(self, obj):
return obj.customer.telephone return obj.customer_telephone
get_customer_name.admin_order_field = 'customer_name' # Allows column order sorting get_customer_name.admin_order_field = 'customer_name' # Allows column order sorting
get_customer_name.short_description = 'Customer Name' # Renames column head get_customer_name.short_description = 'Customer Name' # Renames column head

View File

@ -80,8 +80,8 @@ class ExportView(View):
writer.writerow([order.id, timezone.localtime(order.order_date).strftime("%d/%m/%Y %H:%M"), writer.writerow([order.id, timezone.localtime(order.order_date).strftime("%d/%m/%Y %H:%M"),
order.delivery_date.strftime("%d/%m/%Y"), order.store, order.delivery_date.strftime("%d/%m/%Y"), order.store,
prod.product.name, prod.amount, prod_specs, prod.product.name, prod.amount, prod_specs,
prod.info, order.customer.name, order.customer.telephone, prod.info, order.customer_name, order.customer_telephone,
order.customer.email, order.customer.social_media, order.customer_email, order.customer_social_media,
order.order_info]) order.order_info])
return response return response