Source

django-admin-tools / admin_tools / dashboard / models.py

"""
This module contains the base classes for the dashboard and dashboard modules.
"""
from django.db import models
try:
    from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
    from django.contrib.auth.models import User
else:
    User = get_user_model()

class DashboardPreferences(models.Model):
    """
    This model represents the dashboard preferences for a user.
    """
    user = models.ForeignKey(User)
    data = models.TextField()
    dashboard_id = models.CharField(max_length=100)

    def __unicode__(self):
        return "%s dashboard preferences" % self.user.username

    class Meta:
        db_table = 'admin_tools_dashboard_preferences'
        unique_together = ('user', 'dashboard_id',)
        ordering = ('user',)


# warnings for deprecated imports
from admin_tools.deprecate_utils import import_path_is_changed
from admin_tools.dashboard import dashboards
from admin_tools.dashboard import modules

class Dashboard(
          import_path_is_changed(
              'admin_tools.dashboard.models.Dashboard',
              'admin_tools.dashboard.Dashboard'
          ),
          dashboards.Dashboard
      ): pass

class DefaultIndexDashboard(
          import_path_is_changed(
              'admin_tools.dashboard.models.DefaultIndexDashboard',
              'admin_tools.dashboard.DefaultIndexDashboard',
          ),
          dashboards.DefaultIndexDashboard
      ):pass

class DefaultAppIndexDashboard(
          import_path_is_changed(
              'admin_tools.dashboard.models.DefaultAppIndexDashboard',
              'admin_tools.dashboard.DefaultAppIndexDashboard'
          ),
          dashboards.DefaultAppIndexDashboard
      ):pass

class AppIndexDashboard(
          import_path_is_changed(
              'admin_tools.dashboard.models.AppIndexDashboard',
              'admin_tools.dashboard.AppIndexDashboard'
          ),
          dashboards.AppIndexDashboard
      ):pass


class DashboardModule(
          import_path_is_changed(
              'admin_tools.dashboard.models.DashboardModule',
              'admin_tools.dashboard.modules.DashboardModule',
          ),
          modules.DashboardModule
      ):pass

class AppListDashboardModule(
          import_path_is_changed(
              'admin_tools.dashboard.models.AppListDashboardModule',
              'admin_tools.dashboard.modules.AppList',
          ),
          modules.AppList
      ): pass

class ModelListDashboardModule(
          import_path_is_changed(
              'admin_tools.dashboard.models.ModelListDashboardModule',
              'admin_tools.dashboard.modules.ModelList',
          ),
          modules.ModelList
      ): pass

class LinkListDashboardModule(
          import_path_is_changed(
              'admin_tools.dashboard.models.LinkListDashboardModule',
              'admin_tools.dashboard.modules.LinkList',
          ),
          modules.LinkList
      ): pass

class FeedDashboardModule(
          import_path_is_changed(
              'admin_tools.dashboard.models.FeedDashboardModule',
              'admin_tools.dashboard.modules.Feed',
          ),
          modules.Feed
      ): pass
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.