mirror of
https://github.com/jazzband/django-eav2.git
synced 2026-03-16 22:40:26 +00:00
Cleaned up
This commit is contained in:
parent
debe356381
commit
f6f61cda85
6 changed files with 13 additions and 22 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,5 +1,6 @@
|
|||
*.pyc
|
||||
greav
|
||||
omrs
|
||||
~*
|
||||
*.orig
|
||||
*.db
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class EavEntity(object):
|
|||
|
||||
def __init__(self, instance):
|
||||
self.model = instance
|
||||
'''
|
||||
|
||||
def get_current_eav_attributes(self):
|
||||
try:
|
||||
if self._attributes_cache is not None:
|
||||
|
|
@ -29,7 +29,7 @@ class EavEntity(object):
|
|||
@classmethod
|
||||
def get_eav_attributes(cls):
|
||||
return EavAttribute.objects.all()
|
||||
'''
|
||||
|
||||
|
||||
|
||||
class EavAttribute(models.Model):
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
from django.db import models
|
||||
|
||||
from eav_ng.models import EavEntity, EavAttribute
|
||||
from eav_ng.utils import EavRegistry
|
||||
from ..utils import EavRegistry
|
||||
|
||||
# Create your models here.
|
||||
class Patient(models.Model):
|
||||
class Meta:
|
||||
app_label = 'eav_ng'
|
||||
|
||||
|
||||
name = models.CharField(max_length=20)
|
||||
|
||||
def __unicode__(self):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
"""
|
||||
This file demonstrates two different styles of tests (one doctest and one
|
||||
unittest). These will both pass when you run "manage.py test".
|
||||
|
||||
Replace these with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from django.test import TestCase
|
||||
from django.conf import settings
|
||||
|
||||
from ..models import *
|
||||
from ..utils import EavRegistry, EavAdmin
|
||||
from ..utils import EavRegistry, EavConfig
|
||||
from .models import Patient
|
||||
|
||||
|
||||
|
|
@ -141,7 +135,7 @@ class EavBasicTests(TestCase):
|
|||
def test_eavregistry_accept_a_settings_class_with_get_queryset(self):
|
||||
EavRegistry.unregister(Patient)
|
||||
|
||||
class PatientEav(EavAdmin):
|
||||
class PatientEav(EavConfig):
|
||||
|
||||
def get_eav_attributes(self):
|
||||
return EavAttribute.objects.all()
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
from django.db.models.signals import post_init
|
||||
from eav_ng.managers import EntityManager
|
||||
from eav_ng.models import EavEntity, EavAttribute
|
||||
|
||||
class EavAdmin(object):
|
||||
from .managers import EntityManager
|
||||
from .models import EavEntity, EavAttribute
|
||||
|
||||
class EavConfig(object):
|
||||
@classmethod
|
||||
def get_eav_attributes(cls):
|
||||
"""
|
||||
|
|
@ -33,7 +32,7 @@ class EavRegistry(object):
|
|||
|
||||
|
||||
@staticmethod
|
||||
def register(model_cls, admin_cls=EavAdmin, eav_proxy_field='eav',
|
||||
def register(model_cls, admin_cls=EavConfig, eav_proxy_field='eav',
|
||||
eav_manager_field='objects'):
|
||||
"""
|
||||
Inject eav features into the given model and attach a signal
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ MANAGERS = ADMINS
|
|||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
'NAME': 'myeav.db', # Or path to database file if using sqlite3.
|
||||
'NAME': 'eav_ng.db', # Or path to database file if using sqlite3.
|
||||
'USER': '', # Not used with sqlite3.
|
||||
'PASSWORD': '', # Not used with sqlite3.
|
||||
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
|
||||
|
|
@ -100,6 +100,6 @@ INSTALLED_APPS = (
|
|||
'django_extensions',
|
||||
'eav',
|
||||
'eav_ng',
|
||||
#'eav_usage',
|
||||
'omrs'
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue