Skip to content

Commit

Permalink
Group database columns together in code
Browse files Browse the repository at this point in the history
  • Loading branch information
blag committed Oct 15, 2023
1 parent 3ea3280 commit 67df29f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions user_sessions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ class Session(models.Model):
primary_key=True)
session_data = models.TextField(_('session data'))
expire_date = models.DateTimeField(_('expiry date'), db_index=True)
user = models.ForeignKey(getattr(settings, 'AUTH_USER_MODEL', 'auth.User'),
null=True, on_delete=models.CASCADE)
user_agent = models.CharField(null=True, blank=True, max_length=200)
last_activity = models.DateTimeField(auto_now=True)
ip = models.GenericIPAddressField(null=True, blank=True, verbose_name='IP')

objects = SessionManager()

class Meta:
Expand All @@ -48,9 +54,3 @@ class Meta:

def get_decoded(self):
return SessionStore(None, None).decode(self.session_data)

user = models.ForeignKey(getattr(settings, 'AUTH_USER_MODEL', 'auth.User'),
null=True, on_delete=models.CASCADE)
user_agent = models.CharField(null=True, blank=True, max_length=200)
last_activity = models.DateTimeField(auto_now=True)
ip = models.GenericIPAddressField(null=True, blank=True, verbose_name='IP')

0 comments on commit 67df29f

Please sign in to comment.