mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-23 00:01:16 +00:00
counter: fix eticket server crash induced by old permission system and fix Selling permission
This commit is contained in:
parent
811809895e
commit
241650c171
@ -478,6 +478,8 @@ class Selling(models.Model):
|
||||
return user.is_owner(self.counter) and self.payment_method != "CARD"
|
||||
|
||||
def can_be_viewed_by(self, user):
|
||||
if not hasattr(self, "customer"): # Customer can be set to Null
|
||||
return False
|
||||
return user == self.customer.user
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
|
@ -1752,7 +1752,11 @@ class EticketPDFView(CanViewMixin, DetailView):
|
||||
from reportlab.graphics.barcode.qr import QrCodeWidget
|
||||
from reportlab.graphics import renderPDF
|
||||
|
||||
self.object = self.get_object()
|
||||
if not (
|
||||
hasattr(self.object, "product") and hasattr(self.object.product, "eticket")
|
||||
):
|
||||
raise Http404
|
||||
|
||||
eticket = self.object.product.eticket
|
||||
user = self.object.customer.user
|
||||
code = "%s %s %s %s" % (
|
||||
|
Loading…
Reference in New Issue
Block a user