fak3 avatar fak3 committed 4a87ad4 Draft

django 1.5 configurable user model

Comments (0)

Files changed (2)

admin_tools/dashboard/models.py

 This module contains the base classes for the dashboard and dashboard modules.
 """
 from django.db import models
+from django.conf import settings
+
 
 class DashboardPreferences(models.Model):
     """
     This model represents the dashboard preferences for a user.
     """
-    user = models.ForeignKey('auth.User')
+    user = models.ForeignKey(getattr(settings, 'AUTH_USER_MODEL', 'auth.User'))
     data = models.TextField()
     dashboard_id = models.CharField(max_length=100)
 

admin_tools/menu/models.py

 This module contains the base classes for menu and menu items.
 """
 from django.db import models
+from django.conf import settings
 
 class Bookmark(models.Model):
     """
     This model represents a user created bookmark.
     """
-    user = models.ForeignKey('auth.User')
+    user = models.ForeignKey(getattr(settings, 'AUTH_USER_MODEL', 'auth.User'))
     url = models.CharField(max_length=255)
     title = models.CharField(max_length=255)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.