Update authenthication code to support multitenants. Replace all remaining instances of hardcoded User model.

This commit is contained in:
Roberto Rosario
2016-03-07 03:08:11 -04:00
parent 6492908c59
commit 8a5a26c0b4
13 changed files with 124 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ import hashlib
import logging
import uuid
from django.contrib.auth.models import User
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.files import File
from django.core.urlresolvers import reverse
@@ -806,7 +806,7 @@ class RecentDocument(models.Model):
a given user
"""
user = models.ForeignKey(
User, db_index=True, editable=False, verbose_name=_('User')
settings.AUTH_USER_MODEL, db_index=True, editable=False, verbose_name=_('User')
)
document = models.ForeignKey(
Document, editable=False, verbose_name=_('Document')
@@ -822,7 +822,7 @@ class RecentDocument(models.Model):
def natural_key(self):
return self.document.natural_key() + self.user.natural_key()
natural_key.dependencies = ['documents.Document', 'auth.User']
natural_key.dependencies = ['documents.Document', 'user_management.User']
class Meta:
ordering = ('-datetime_accessed',)