-
Ernesto Rico Schmidt authoredErnesto Rico Schmidt authored
models.py 1.62 KiB
#
# steering, Programme/schedule management for AURA
#
# Copyright (C) 2017-2018, Ingo Leindecker
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import gettext_lazy as _
class Profile(models.Model):
user = models.OneToOneField(
User, on_delete=models.CASCADE, related_name="profile", editable=False
)
cba_username = models.CharField(_("CBA Username"), blank=True, max_length=60)
cba_user_token = models.CharField(_("CBA Token"), blank=True, max_length=255)
# FIXME: these fields should be from an abstract model
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.CharField(max_length=150)
updated_at = models.DateTimeField(auto_now=True)
updated_by = models.CharField(max_length=150)
def __str__(self):
return self.user.username
class Meta:
db_table = "profile"
def save(self, *args, **kwargs):
super(Profile, self).save(*args, **kwargs)