Changeset - 908dca311ce9
[Not reviewed]
0 2 0
Tobias - 6 years ago 2019-01-21 03:44:51
tobiasschulmann@catalyst.net.nz
Revert mixin changes
2 files changed with 5 insertions and 7 deletions:
0 comments (0 inline, 0 general)
pinaxcon/raffle/mixins.py
Show inline comments
...
 
@@ -36,7 +36,7 @@ class RaffleMixin:
 
            yield (item['id'], list(create_ticket_numbers(item)))
 

	
 

	
 
class LockMixin():
 
class PrizeMixin:
 
    @property
 
    def locked(self):
 
        return self._locked
...
 
@@ -45,8 +45,6 @@ class LockMixin():
 
        self.audit_events.create(user=user, reason="Unlocked")
 
        self._locked = False
 

	
 

	
 
class PrizeMixin:
 
    def remove_winner(self, user):
 
        reason = "Removed winning ticket: {}".format(self.winning_ticket.id)
 
        self.audit_events.create(user=user, reason=reason)
pinaxcon/raffle/models.py
Show inline comments
 
from django.db import models
 

	
 
from pinaxcon.raffle.mixins import PrizeMixin, RaffleMixin, LockMixin
 
from pinaxcon.raffle.mixins import PrizeMixin, RaffleMixin
 

	
 

	
 
class Raffle(RaffleMixin, models.Model):
...
 
@@ -16,7 +16,7 @@ class Raffle(RaffleMixin, models.Model):
 
        return self.description
 

	
 

	
 
class Prize(PrizeMixin, LockMixin, models.Model):
 
class Prize(PrizeMixin, models.Model):
 
    """
 
    Stores a Prize for a given :model:`pinaxcon_raffle.Raffle`.
 

	
...
 
@@ -56,7 +56,7 @@ class PrizeAudit(models.Model):
 
        return self.reason
 

	
 

	
 
class Draw(LockMixin, models.Model):
 
class Draw(models.Model):
 
    """
 
    Stores a draw for a given :model:`pinaxcon_raffle.Raffle`, along with audit fields
 
    for the creating :model:`auth.User` and the creation timestamp.
...
 
@@ -69,7 +69,7 @@ class Draw(LockMixin, models.Model):
 
        return f"{self.raffle}: {self.drawn_time}"
 

	
 

	
 
class DrawnTicket(LockMixin, models.Model):
 
class DrawnTicket(models.Model):
 
    """
 
    Stores the result of a ticket draw, along with the corresponding
 
    :model:`pinaxcon_raffle.Draw`, :model:`pinaxcon_raffle.Prize` and the
0 comments (0 inline, 0 general)