Compare commits

...

6 Commits

Author SHA1 Message Date
17601109c6 Add migrations for new profile. 2024-06-13 12:00:58 -04:00
5527fe9b4d Update requirements file. 2024-06-13 11:59:39 -04:00
3c335d53a4 Add super basic user profile model.
for now just has encrypted brewfather api credentials.
2024-06-13 11:53:48 -04:00
a144144942 Merge branch 'dev' 2024-06-07 18:12:37 -04:00
e4e040cca7 Merge pull request 'Merge dev' (#9) from dev into master
Reviewed-on: #9
2024-06-07 17:33:28 -04:00
1e8d79b7cf Merge pull request 'Update from dev branch' (#7) from dev into master
Reviewed-on: #7
2024-06-07 11:44:03 -04:00
3 changed files with 46 additions and 5 deletions

View 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,
},
),
]

View File

@ -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)

View File

@ -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