Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User(BaseModel):
- # User in our system
- username = models.CharField()
- email = models.EmailField()
- password = models.CharField() # DO NOT ACTUALLY DO THIS
- class DeviceLogin(BaseModel):
- # Different devices a user could potentially login from
- DESKTOP = 'DSK'
- PHONE = 'PHN'
- TABLET = 'TBL'
- LOGIN_NAME_CHOICES = [
- (DESKTOP , 'Desktop'),
- (PHONE , 'Phone'),
- (TABLET , 'Tablet'),
- ]
- logins = models.IntField()
- type = models.CharField(
- max_length=3,
- choices=LOGIN_NAME_CHOICES,
- db_index=True,
- unique=True
- )
- class UserDeviceLogin(BaseModel):
- # Represent a mapping of user to different devices logged in with
- user = models.ForeignKey(MoodyUser, on_delete=models.CASCADE)
- login = models.ForeignKey(DeviceLogin, on_delete=models.CASCADE)
- class Meta:
- unique_together = ('user', 'login ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement