Working .env setup

This commit is contained in:
2026-08-03 10:39:19 -05:00
parent f593d16ca4
commit 2764644d8b
19 changed files with 546 additions and 66 deletions
+34 -1
View File
@@ -1,3 +1,36 @@
from django.conf import settings
from django.db import models
# Create your models here.
class UserProfile(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name='userprofile',
)
bio = models.TextField(blank=True, default='')
avatar = models.ImageField(
upload_to='profiles/%d/',
blank=True,
null=True,
)
joined = models.DateTimeField(auto_now_add=True)
def __str__(self):
return f'{self.user.username} profile'
class ApiToken(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name='api_tokens',
)
token = models.TextField()
key_prefix = models.CharField(max_length=8, db_index=True)
label = models.CharField(max_length=64, default='API token')
created_at = models.DateTimeField(auto_now_add=True)
last_used = models.DateTimeField(null=True, blank=True)
def __str__(self):
return f'{self.user.username} - {self.label} ({self.key_prefix}...)'