(tezst) des@des-desktop:~/job/$ pip install django-url-filter==0.3.0
Collecting django-url-filter==0.3.0
Downloading django_url_filter-0.3.0-py2.py3-none-any.whl
Collecting cached-property (from django-url-filter==0.3.0)
Downloading cached_property-1.3.0-py2.py3-none-any.whl
Installing collected packages: cached-property, django-url-filter
Successfully installed cached-property-1.3.0 django-url-filter-0.3.0
(tezst) des@des-desktop:~/job/$ pip install django-url-filter==0.2.0
Collecting django-url-filter==0.2.0
Downloading django-url-filter-0.2.0.tar.gz
Building wheels for collected packages: django-url-filter
Running setup.py bdist_wheel for django-url-filter ... done
Stored in directory: /home/des/.cache/pip/wheels/05/9a/80/4e2e9dacdb91607accafb71c72df59b561c5f51549f4da3e13
Successfully built django-url-filter
Installing collected packages: django-url-filter
Found existing installation: django-url-filter 0.3.0
Uninstalling django-url-filter-0.3.0:
Successfully uninstalled django-url-filter-0.3.0
Successfully installed django-url-filter-0.2.0
host_patterns = patterns('',
host(r'', settings.ROOT_URLCONF, name='www'),
host(r'(www\.)*(?P<subdomain>[0-9a-z\-]+)', 'base.urls', callback='base.callbacks.host_subdomains', name='subdomain-area'),
)
def host_subdomains(request, *args, **kwargs):
# ищим адрес сабдомена kwargs
class ProductColors(models.Model):
s = models.ForeignKey(Products)
colors = models.ManyToManyField(to=Colors)
class Colors(models.Model):
name = models.CharField(verbose_name="Название цвета")
pip install django-cleanup
def wrap(model_or_iterable, admin_class=None, **option):
if isinstance(model_or_iterable, ModelBase):
model_or_iterable = [model_or_iterable]
for model in model_or_iterable:
if model.__module__ != self.module:
continue
if admin_class is None:
admin_class = type(model.__name__+'Admin',
(admin.ModelAdmin,), {})
admin_class.add_view = rename_breadcrumbs(admin_class.add_view)
admin_class.change_view = rename_breadcrumbs(admin_class.change_view)
admin_class.changelist_view = rename_breadcrumbs(admin_class.changelist_view)
model._meta.app_label = self.string_with_realoaded_title(
self.native_app_label,
self.app_label)
return f(model, admin_class, **option)
return wrap
if model.__module__ != self.module:
continue