Skip to content

Commit

Permalink
Merge pull request #62 from johnfraney/patch-1
Browse files Browse the repository at this point in the history
Update models.py
  • Loading branch information
valdergallo committed Jan 28, 2015
2 parents 9ae4235 + 3443613 commit d041232
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions data_importer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from uuid import uuid4
from django.core.servers.basehttp import FileWrapper
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
Expand All @@ -29,7 +28,7 @@ def get_random_filename(instance, filename):
filename = "%s%s" % (str(uuid4()), ext)
user_dir = "anonymous"
if instance.owner:
user_dir = instance.owner.username
user_dir = instance.owner.get_username()
return os.path.join('upload_history',
user_dir,
date.today().strftime("%Y/%m/%d"),
Expand All @@ -41,7 +40,7 @@ class FileHistory(models.Model):
updated_at = models.DateTimeField(auto_now=True)
active = models.BooleanField(default=True, db_index=True)
file_upload = models.FileField(upload_to=get_random_filename)
owner = models.ForeignKey(User, null=True)
owner = models.ForeignKey(settings.AUTH_USER_MODEL, null=True)
is_task = models.BooleanField(default=DATA_IMPORTER_TASK)
status = models.IntegerField(choices=CELERY_STATUS, default=1)

Expand Down

0 comments on commit d041232

Please sign in to comment.