Compare commits
6 Commits
67ab836ee4
...
17601109c6
Author | SHA1 | Date | |
---|---|---|---|
17601109c6 | |||
5527fe9b4d | |||
3c335d53a4 | |||
a144144942 | |||
e4e040cca7 | |||
1e8d79b7cf |
31
beer/migrations/0002_userprofile.py
Normal file
31
beer/migrations/0002_userprofile.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-13 16:00
|
||||
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
import django_cryptography.fields
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('beer', '0001_initial'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='UserProfile',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_date', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('brewfather_api_user', django_cryptography.fields.encrypt(models.TextField(max_length=128))),
|
||||
('brewfather_api_key', django_cryptography.fields.encrypt(models.TextField(max_length=128))),
|
||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
@ -1,7 +1,9 @@
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django_cryptography.fields import encrypt
|
||||
|
||||
from config.extras import BREWFATHER_APP_ROOT
|
||||
from django.conf import settings
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('django')
|
||||
@ -13,6 +15,13 @@ class CustomModel(models.Model):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class UserProfile(CustomModel):
|
||||
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
||||
brewfather_api_user = encrypt(models.TextField(max_length=128))
|
||||
brewfather_api_key = encrypt(models.TextField(max_length=128))
|
||||
|
||||
def __str__(self):
|
||||
return self.user.username
|
||||
|
||||
class Batch(CustomModel):
|
||||
brewfather_id = models.CharField(max_length=50)
|
||||
|
@ -1,10 +1,11 @@
|
||||
Django==5.0.6
|
||||
dj-database-url==2.1.0
|
||||
psycopg2-binary==2.9.9
|
||||
environs==11.0.0
|
||||
docutils==0.21.2
|
||||
django-cryptography-django5==2.2
|
||||
django-mathfilters==1.0.0
|
||||
docutils==0.21.2
|
||||
environs==11.0.0
|
||||
gunicorn==22.0.0
|
||||
pip-chill==1.0.3
|
||||
psycopg2-binary==2.9.9
|
||||
pylabels==1.2.1
|
||||
reportlab==4.2.0
|
||||
wiki==0.11.1
|
||||
gunicorn==22.0.0
|
||||
|
Loading…
Reference in New Issue
Block a user