2006-05-02 09:31:56 +08:00
|
|
|
from django.conf import settings
|
|
|
|
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
|
|
|
|
from django.core import validators
|
2007-08-20 10:28:40 +08:00
|
|
|
from django.db import connection
|
2006-05-02 09:31:56 +08:00
|
|
|
from django.db.models.loading import get_apps, get_app, get_models, get_model, register_models
|
|
|
|
from django.db.models.query import Q
|
|
|
|
from django.db.models.manager import Manager
|
|
|
|
from django.db.models.base import Model, AdminOptions
|
|
|
|
from django.db.models.fields import *
|
2007-11-05 21:59:42 +08:00
|
|
|
from django.db.models.fields.subclassing import SubfieldBase
|
2006-05-02 09:31:56 +08:00
|
|
|
from django.db.models.fields.related import ForeignKey, OneToOneField, ManyToManyField, ManyToOneRel, ManyToManyRel, OneToOneRel, TABULAR, STACKED
|
|
|
|
from django.db.models import signals
|
|
|
|
from django.utils.functional import curry
|
|
|
|
from django.utils.text import capfirst
|
|
|
|
|
|
|
|
# Admin stages.
|
|
|
|
ADD, CHANGE, BOTH = 1, 2, 3
|
|
|
|
|
2006-07-28 10:09:38 +08:00
|
|
|
def permalink(func):
|
2007-07-16 21:47:43 +08:00
|
|
|
"""
|
|
|
|
Decorator that calls urlresolvers.reverse() to return a URL using
|
|
|
|
parameters returned by the decorated function "func".
|
|
|
|
|
|
|
|
"func" should be a function that returns a tuple in one of the
|
|
|
|
following formats:
|
|
|
|
(viewname, viewargs)
|
|
|
|
(viewname, viewargs, viewkwargs)
|
|
|
|
"""
|
2006-07-28 10:09:38 +08:00
|
|
|
from django.core.urlresolvers import reverse
|
|
|
|
def inner(*args, **kwargs):
|
|
|
|
bits = func(*args, **kwargs)
|
2006-08-09 22:40:29 +08:00
|
|
|
return reverse(bits[0], None, *bits[1:3])
|
2006-07-28 10:09:38 +08:00
|
|
|
return inner
|