Guest User

Untitled

a guest
Apr 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. class Meta:
  2. unique_together = ( ('name', 'active'),)
  3.  
  4. class BaseModel(models.Model):
  5. # all of your fields here
  6. active = models.BooleanField()
  7.  
  8.  
  9. class ActiveModel(BaseModel):
  10. class Meta:
  11. unique_together = ('whatever', 'fields')
  12.  
  13. def make_inactive(self):
  14. # create a new instance of InactiveModel based on
  15. # this instances's values, then delete this instance
  16.  
  17.  
  18. class InactiveModel(BaseModel):
  19. def make_active(self):
  20. # create a new instance of InactiveModel based on
  21. # this instances's values, then delete this instance
Add Comment
Please, Sign In to add comment