mirror of
https://github.com/jazzband/django-eav2.git
synced 2026-05-18 04:21:12 +00:00
parent
5ac886e75e
commit
9bf3dbfb5d
11 changed files with 23 additions and 56 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
__version__ = '0.9.2'
|
__version__ = '0.9.2'
|
||||||
|
|
||||||
|
|
||||||
def register(model_cls, config_cls=None):
|
def register(model_cls, config_cls=None):
|
||||||
from .registry import Registry
|
from .registry import Registry
|
||||||
Registry.register(model_cls, config_cls)
|
Registry.register(model_cls, config_cls)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
'''Admin. This module contains classes used for admin integration.'''
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.admin.options import (InlineModelAdmin, ModelAdmin,
|
from django.contrib.admin.options import (InlineModelAdmin, ModelAdmin,
|
||||||
StackedInline)
|
StackedInline)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
'''
|
'''
|
||||||
Decorators module.
|
Decorators.
|
||||||
|
|
||||||
This module contains pure wrapper functions used as decorators.
|
This module contains pure wrapper functions used as decorators.
|
||||||
Functions in this module should be simple and not involve complex logic.
|
Functions in this module should be simple and not involve complex logic.
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
'''
|
'''
|
||||||
******
|
Fields.
|
||||||
fields
|
|
||||||
******
|
|
||||||
|
|
||||||
Contains two custom fields:
|
Contains two custom fields:
|
||||||
|
* :class:`EavSlugField`
|
||||||
* :class:`EavSlugField`
|
* :class:`EavDatatypeField`
|
||||||
* :class:`EavDatatypeField`
|
|
||||||
|
|
||||||
Classes
|
|
||||||
-------
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
|
||||||
10
eav/forms.py
10
eav/forms.py
|
|
@ -1,13 +1,5 @@
|
||||||
'''
|
'''Forms. This module contains forms used for admin integration.'''
|
||||||
#####
|
|
||||||
forms
|
|
||||||
#####
|
|
||||||
|
|
||||||
The forms used for admin integration
|
|
||||||
|
|
||||||
Classes
|
|
||||||
-------
|
|
||||||
'''
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from django.contrib.admin.widgets import AdminSplitDateTime
|
from django.contrib.admin.widgets import AdminSplitDateTime
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,9 @@
|
||||||
'''
|
'''
|
||||||
********
|
Managers.
|
||||||
managers
|
|
||||||
********
|
|
||||||
Contains the custom manager used by entities registered with eav.
|
|
||||||
|
|
||||||
Functions and Classes
|
This module contains the custom manager used by entities registered with eav.
|
||||||
---------------------
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from .queryset import EavQuerySet
|
from .queryset import EavQuerySet
|
||||||
|
|
@ -14,7 +11,7 @@ from .queryset import EavQuerySet
|
||||||
|
|
||||||
class EntityManager(models.Manager):
|
class EntityManager(models.Manager):
|
||||||
'''
|
'''
|
||||||
Our custom manager, overriding ``models.Manager``
|
Our custom manager, overrides ``models.Manager``.
|
||||||
'''
|
'''
|
||||||
_queryset_class = EavQuerySet
|
_queryset_class = EavQuerySet
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,15 @@
|
||||||
'''
|
'''
|
||||||
******
|
Models.
|
||||||
models
|
|
||||||
******
|
|
||||||
This module defines the four concrete, non-abstract models:
|
|
||||||
|
|
||||||
* :class:`Value`
|
This module defines the four concrete, non-abstract models:
|
||||||
* :class:`Attribute`
|
* :class:`Value`
|
||||||
* :class:`EnumValue`
|
* :class:`Attribute`
|
||||||
* :class:`EnumGroup`
|
* :class:`EnumValue`
|
||||||
|
* :class:`EnumGroup`
|
||||||
|
|
||||||
Along with the :class:`Entity` helper class.
|
Along with the :class:`Entity` helper class.
|
||||||
|
|
||||||
Classes
|
|
||||||
-------
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.contenttypes import fields as generic
|
from django.contrib.contenttypes import fields as generic
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
'''
|
'''
|
||||||
Queryset module.
|
Queryset.
|
||||||
|
|
||||||
This module contains custom EavQuerySet class used for overriding
|
This module contains custom EavQuerySet class used for overriding
|
||||||
relational operators and pure functions for rewriting Q-expressions.
|
relational operators and pure functions for rewriting Q-expressions.
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,4 @@
|
||||||
'''
|
'''Registry. This modules contains the registry classes.'''
|
||||||
########
|
|
||||||
registry
|
|
||||||
########
|
|
||||||
|
|
||||||
This contains the registry classes
|
|
||||||
|
|
||||||
Classes
|
|
||||||
-------
|
|
||||||
'''
|
|
||||||
|
|
||||||
from django.contrib.contenttypes import fields as generic
|
from django.contrib.contenttypes import fields as generic
|
||||||
from django.db.models.signals import post_init, post_save, pre_init, pre_save
|
from django.db.models.signals import post_init, post_save, pre_init, pre_save
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
'''Utilities. This module contains non-essential helper methods.'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
'''
|
'''
|
||||||
**********
|
Validtors.
|
||||||
validators
|
|
||||||
**********
|
|
||||||
This module contains a validator for each Attribute datatype.
|
This module contains a validator for each Attribute datatype.
|
||||||
|
|
||||||
A validator is a callable that takes a value and raises a ``ValidationError``
|
A validator is a callable that takes a value and raises a ``ValidationError``
|
||||||
|
|
@ -11,9 +10,6 @@ if it doesn’t meet some criteria. (see
|
||||||
These validators are called by the
|
These validators are called by the
|
||||||
:meth:`~eav.models.Attribute.validate_value` method in the
|
:meth:`~eav.models.Attribute.validate_value` method in the
|
||||||
:class:`~eav.models.Attribute` model.
|
:class:`~eav.models.Attribute` model.
|
||||||
|
|
||||||
Functions
|
|
||||||
---------
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue