Created
September 26, 2017 12:08
-
-
Save elcolie/52daf2bd144af82b348f7353656be434 to your computer and use it in GitHub Desktop.
models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.contrib.auth.models import User | |
from django.utils.translation import ugettext_lazy as _ | |
class AbstractTimeStampMarker(models.Model): | |
created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Created at")) | |
updated_at = models.DateTimeField(auto_now=True, verbose_name=_("Updated at")) | |
class Meta: | |
abstract = True | |
class AbstractModelController(AbstractTimeStampMarker): | |
created_user = models.ForeignKey(User, related_name="%(class)s_created_user", verbose_name=_("Created User")) | |
updated_user = models.ForeignKey(User, related_name="%(class)s_updated_user", verbose_name=_("Updated User")) | |
class Meta: | |
abstract = True | |
class CustomerFromExcel(AbstractModelController): | |
file = models.FileField(upload_to='customers') | |
def __str__(self): | |
return f'{self.file.name} {self.created_at}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment