Revert mixin changes
This commit is contained in:
		
							parent
							
								
									30e8d95811
								
							
						
					
					
						commit
						908dca311c
					
				
					 2 changed files with 5 additions and 7 deletions
				
			
		|  | @ -36,7 +36,7 @@ class RaffleMixin: | ||||||
|             yield (item['id'], list(create_ticket_numbers(item))) |             yield (item['id'], list(create_ticket_numbers(item))) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class LockMixin(): | class PrizeMixin: | ||||||
|     @property |     @property | ||||||
|     def locked(self): |     def locked(self): | ||||||
|         return self._locked |         return self._locked | ||||||
|  | @ -45,8 +45,6 @@ class LockMixin(): | ||||||
|         self.audit_events.create(user=user, reason="Unlocked") |         self.audit_events.create(user=user, reason="Unlocked") | ||||||
|         self._locked = False |         self._locked = False | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| class PrizeMixin: |  | ||||||
|     def remove_winner(self, user): |     def remove_winner(self, user): | ||||||
|         reason = "Removed winning ticket: {}".format(self.winning_ticket.id) |         reason = "Removed winning ticket: {}".format(self.winning_ticket.id) | ||||||
|         self.audit_events.create(user=user, reason=reason) |         self.audit_events.create(user=user, reason=reason) | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| from django.db import models | 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): | class Raffle(RaffleMixin, models.Model): | ||||||
|  | @ -16,7 +16,7 @@ class Raffle(RaffleMixin, models.Model): | ||||||
|         return self.description |         return self.description | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Prize(PrizeMixin, LockMixin, models.Model): | class Prize(PrizeMixin, models.Model): | ||||||
|     """ |     """ | ||||||
|     Stores a Prize for a given :model:`pinaxcon_raffle.Raffle`. |     Stores a Prize for a given :model:`pinaxcon_raffle.Raffle`. | ||||||
| 
 | 
 | ||||||
|  | @ -56,7 +56,7 @@ class PrizeAudit(models.Model): | ||||||
|         return self.reason |         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 |     Stores a draw for a given :model:`pinaxcon_raffle.Raffle`, along with audit fields | ||||||
|     for the creating :model:`auth.User` and the creation timestamp. |     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}" |         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 |     Stores the result of a ticket draw, along with the corresponding | ||||||
|     :model:`pinaxcon_raffle.Draw`, :model:`pinaxcon_raffle.Prize` and the |     :model:`pinaxcon_raffle.Draw`, :model:`pinaxcon_raffle.Prize` and the | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Tobias
						Tobias