git.ithinksw.org
/
philo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Resolves issue #71 for the admin interface by working around the use of modelform_fac...
[philo.git]
/
models
/
base.py
diff --git
a/models/base.py
b/models/base.py
index
836fe4a
..
af1e880
100644
(file)
--- a/
models/base.py
+++ b/
models/base.py
@@
-55,10
+55,6
@@
def unregister_value_model(model):
class AttributeValue(models.Model):
attribute_set = generic.GenericRelation('Attribute', content_type_field='value_content_type', object_id_field='value_object_id')
class AttributeValue(models.Model):
attribute_set = generic.GenericRelation('Attribute', content_type_field='value_content_type', object_id_field='value_object_id')
- @property
- def attribute(self):
- return self.attribute_set.all()[0]
-
def set_value(self, value):
raise NotImplementedError
def set_value(self, value):
raise NotImplementedError
@@
-275,9
+271,9
@@
class EntityOptions(object):
class EntityBase(models.base.ModelBase):
def __new__(cls, name, bases, attrs):
class EntityBase(models.base.ModelBase):
def __new__(cls, name, bases, attrs):
+ entity_meta = attrs.pop('EntityMeta', None)
new = super(EntityBase, cls).__new__(cls, name, bases, attrs)
new = super(EntityBase, cls).__new__(cls, name, bases, attrs)
- entity_options = attrs.pop('EntityMeta', None)
- setattr(new, '_entity_meta', EntityOptions(entity_options))
+ new.add_to_class('_entity_meta', EntityOptions(entity_meta))
entity_class_prepared.send(sender=new)
return new
entity_class_prepared.send(sender=new)
return new