diff options
author | anuja <anuja@labadmin-Vostro1510.(none)> | 2012-07-18 16:54:40 +0530 |
---|---|---|
committer | anuja <anuja@labadmin-Vostro1510.(none)> | 2012-07-18 16:54:40 +0530 |
commit | 0e1ae1d29b9ce5b9b55984d5f2207ddef3fa187d (patch) | |
tree | 17e08c495fe135c6a1958818cb15241f5344d9b1 /gstudio | |
parent | 70558a843bf579d0ec62c9acbd98e249bdaf8103 (diff) | |
download | gnowsys-0e1ae1d29b9ce5b9b55984d5f2207ddef3fa187d.tar.gz |
Added "metatypes" field to some tables in models
Diffstat (limited to 'gstudio')
29 files changed, 266 insertions, 94 deletions
diff --git a/gstudio/admin/attribute.py b/gstudio/admin/attribute.py index babc9de..ed9c436 100644 --- a/gstudio/admin/attribute.py +++ b/gstudio/admin/attribute.py @@ -16,12 +16,11 @@ else: parent_class = admin.ModelAdmin class AttributeAdmin(parent_class): - fieldsets=((_('Attribute'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope')}), + fieldsets=((_('Attribute'),{'fields': ('metatypes','subject','attributetype','attributetype_scope','subject_scope','svalue','value_scope')}), ) - class Media: js = ("gstudio/js/gstudio.js",) diff --git a/gstudio/admin/attribute_bigintegerfield.py b/gstudio/admin/attribute_bigintegerfield.py index 6e0938c..0707cf8 100644 --- a/gstudio/admin/attribute_bigintegerfield.py +++ b/gstudio/admin/attribute_bigintegerfield.py @@ -12,7 +12,7 @@ else: parent_class = admin.ModelAdmin class AttributeBigIntegerFieldAdmin(parent_class): - fieldsets=((_('AttributeBigIntegerField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeBigIntegerField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_booleanfield.py b/gstudio/admin/attribute_booleanfield.py index e5d29fe..d2d64ca 100644 --- a/gstudio/admin/attribute_booleanfield.py +++ b/gstudio/admin/attribute_booleanfield.py @@ -15,6 +15,6 @@ class AttributeBooleanFieldAdmin(parent_class): ) prepopulated_fields = {'svalue': ('value',)} def save_model(self, request, attributebooleanfield, form, change): - attributebigintegerfield.title = attributeboofield.composed_sentence - attributebigintegerfield.slug = slugify(attributebigintegerfield.title) - attributebigintegerfield.save() + attributebooleanfield.title = attributebooleanfield.composed_sentence + attributebooleanfield.slug = slugify(attributebooleanfield.title) + attributebooleanfield.save() diff --git a/gstudio/admin/attribute_charfield.py b/gstudio/admin/attribute_charfield.py index afa41b7..281e806 100644 --- a/gstudio/admin/attribute_charfield.py +++ b/gstudio/admin/attribute_charfield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeCharFieldAdmin(parent_class): - fieldsets=((_('AttributeCharField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeCharField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value',)} diff --git a/gstudio/admin/attribute_commaseparatedintegerfield.py b/gstudio/admin/attribute_commaseparatedintegerfield.py index b09d4d4..77ea728 100644 --- a/gstudio/admin/attribute_commaseparatedintegerfield.py +++ b/gstudio/admin/attribute_commaseparatedintegerfield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeCommaSeparatedIntegerFieldAdmin(parent_class): - fieldsets=((_('AttributeCommaSeparatedIntegerField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeCommaSeparatedIntegerField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value',)} diff --git a/gstudio/admin/attribute_datefield.py b/gstudio/admin/attribute_datefield.py index 2856d23..7b7b8a8 100644 --- a/gstudio/admin/attribute_datefield.py +++ b/gstudio/admin/attribute_datefield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeDateFieldAdmin(parent_class): - fieldsets=((_('AttributeDateField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeDateField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value',)} diff --git a/gstudio/admin/attribute_datetimefield.py b/gstudio/admin/attribute_datetimefield.py index e4de8b9..f64b293 100644 --- a/gstudio/admin/attribute_datetimefield.py +++ b/gstudio/admin/attribute_datetimefield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeDateTimeFieldAdmin(parent_class): - fieldsets=((_('AttributeDateTimeField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeDateTimeField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_decimalfield.py b/gstudio/admin/attribute_decimalfield.py index b32c760..6925b5a 100644 --- a/gstudio/admin/attribute_decimalfield.py +++ b/gstudio/admin/attribute_decimalfield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeDecimalFieldAdmin(parent_class): - fieldsets=((_('AttributeDecimalField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeDecimalField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value',)} diff --git a/gstudio/admin/attribute_emailfield.py b/gstudio/admin/attribute_emailfield.py index 5fe1af9..e4fdd9c 100644 --- a/gstudio/admin/attribute_emailfield.py +++ b/gstudio/admin/attribute_emailfield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeEmailFieldAdmin(parent_class): - fieldsets=((_('AttributEmailField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributEmailField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_filefield.py b/gstudio/admin/attribute_filefield.py index 61a3497..6f22f28 100644 --- a/gstudio/admin/attribute_filefield.py +++ b/gstudio/admin/attribute_filefield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeFileFieldAdmin(parent_class): - fieldsets=((_('AttributeFileField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeFileField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_filepathfield.py b/gstudio/admin/attribute_filepathfield.py index cf570a7..d230984 100644 --- a/gstudio/admin/attribute_filepathfield.py +++ b/gstudio/admin/attribute_filepathfield.py @@ -10,7 +10,7 @@ else: parent_class = admin.ModelAdmin class AttributeFilePathFieldAdmin(parent_class): - fieldsets=((_('AttributeFilePathField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeFilePathField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_floatfield.py b/gstudio/admin/attribute_floatfield.py index 23ab024..2c10b41 100644 --- a/gstudio/admin/attribute_floatfield.py +++ b/gstudio/admin/attribute_floatfield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeFloatFieldAdmin(parent_class): - fieldsets=((_('AttributeFloatField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeFloatField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_imagefield.py b/gstudio/admin/attribute_imagefield.py index c200509..e6be93e 100644 --- a/gstudio/admin/attribute_imagefield.py +++ b/gstudio/admin/attribute_imagefield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeImageFieldAdmin(parent_class): - fieldsets=((_('AttributeImageField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeImageField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_integerfield.py b/gstudio/admin/attribute_integerfield.py index bfc8459..aef3832 100644 --- a/gstudio/admin/attribute_integerfield.py +++ b/gstudio/admin/attribute_integerfield.py @@ -12,7 +12,7 @@ else: class AttributeIntegerFieldAdmin(parent_class): - fieldsets=((_('AttributIntegerField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributIntegerField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_ipaddressfield.py b/gstudio/admin/attribute_ipaddressfield.py index 0856966..396ede6 100644 --- a/gstudio/admin/attribute_ipaddressfield.py +++ b/gstudio/admin/attribute_ipaddressfield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeIPAddressFieldAdmin(parent_class): - fieldsets=((_('AttributeIPAddressField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeIPAddressField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_nullbooleanfield.py b/gstudio/admin/attribute_nullbooleanfield.py index 279677d..ff8f879 100644 --- a/gstudio/admin/attribute_nullbooleanfield.py +++ b/gstudio/admin/attribute_nullbooleanfield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeNullBooleanFieldAdmin(parent_class): - fieldsets=((_('AttributeNullBooleanField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeNullBooleanField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_positiveintegerfield.py b/gstudio/admin/attribute_positiveintegerfield.py index 67bbbf6..f963558 100644 --- a/gstudio/admin/attribute_positiveintegerfield.py +++ b/gstudio/admin/attribute_positiveintegerfield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributePositiveIntegerFieldAdmin(parent_class): - fieldsets=((_('AttributePositiveIntegerField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributePositiveIntegerField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_textfield.py b/gstudio/admin/attribute_textfield.py index 3501668..755c582 100644 --- a/gstudio/admin/attribute_textfield.py +++ b/gstudio/admin/attribute_textfield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeTextFieldAdmin(parent_class): - fieldsets=((_('AttributeTextField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeTextField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_timefield.py b/gstudio/admin/attribute_timefield.py index 0c1c5a0..dac2c41 100644 --- a/gstudio/admin/attribute_timefield.py +++ b/gstudio/admin/attribute_timefield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeTimeFieldAdmin(parent_class): - fieldsets=((_('AttributeTimeField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeTimeField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attribute_urlfield.py b/gstudio/admin/attribute_urlfield.py index 6f77381..b65a27d 100644 --- a/gstudio/admin/attribute_urlfield.py +++ b/gstudio/admin/attribute_urlfield.py @@ -11,7 +11,7 @@ else: parent_class = admin.ModelAdmin class AttributeURLFieldAdmin(parent_class): - fieldsets=((_('AttributeURLField'),{'fields': ('attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), + fieldsets=((_('AttributeURLField'),{'fields': ('metatypes','attributetype','attributetype_scope','subject','subject_scope','svalue','value_scope','value')}), ) prepopulated_fields = {'svalue': ('value', )} diff --git a/gstudio/admin/attributespecification.py b/gstudio/admin/attributespecification.py index 781343b..8e9bc5f 100644 --- a/gstudio/admin/attributespecification.py +++ b/gstudio/admin/attributespecification.py @@ -2,6 +2,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import slugify from gstudio.admin.forms import AttributeSpecificationAdminForm from gstudio.settings import GSTUDIO_VERSIONING @@ -12,4 +13,12 @@ else: parent_class = admin.ModelAdmin class AttributeSpecificationAdmin(parent_class): - pass + fieldsets=((_('AttributeSpecification'),{'fields': ('metatypes','title','attributetype','subjects','slug')}), + +) + prepopulated_fields = {'slug': ('title', )} + def save_model(self, request, attributespecification, form, change): + #attributespecification.title = attributespecification.composed_subject + attributespecification.slug = slugify(attributespecification.title) + attributespecification.save() + diff --git a/gstudio/admin/complement.py b/gstudio/admin/complement.py index 305bb46..6cff088 100644 --- a/gstudio/admin/complement.py +++ b/gstudio/admin/complement.py @@ -2,6 +2,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import slugify from gstudio.admin.forms import ComplementAdminForm import reversion from gstudio.settings import GSTUDIO_VERSIONING @@ -11,4 +12,9 @@ else: parent_class = admin.ModelAdmin class ComplementAdmin(parent_class): - pass + fieldsets=((_('Complement'),{'fields':('title','nodetypes','metatypes','slug')}),) + + def save_model(self, request, complement, form, change): + #complement.title=self.composed_subject + complement.slug=slugify(complement.title) + complement.save() diff --git a/gstudio/admin/expression.py b/gstudio/admin/expression.py index cebd696..49a6f2d 100644 --- a/gstudio/admin/expression.py +++ b/gstudio/admin/expression.py @@ -2,6 +2,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import slugify from gstudio.admin.forms import ExpressionAdminForm import reversion @@ -12,7 +13,11 @@ else: parent_class = admin.ModelAdmin class ExpressionAdmin(parent_class): - def save_model(self, request, expression, form, change): + fieldsets=((_('Expression'),{'fields': ('metatypes','title','left_term','relationtype','right_term','slug')}), + ) + prepopulated_fields = {'slug': ('title', )} + def save_model(self, request,expression, form, change): expression.title = expression.composed_sentence + expression.slug = slugify(expression.title) expression.save() diff --git a/gstudio/admin/intersection.py b/gstudio/admin/intersection.py index 49f2c5d..8658f50 100644 --- a/gstudio/admin/intersection.py +++ b/gstudio/admin/intersection.py @@ -11,4 +11,11 @@ else: parent_class = admin.ModelAdmin class IntersectionAdmin(parent_class): - pass + fieldsets=((_('Intersection'),{'fields': ('metatypes','title','nodetypes','slug')}), + ) + prepopulated_fields = {'slug': ('title', )} + def save_model(self, request,intersection, form, change): + #intersection.title = intersection.composed_subject + intersection.slug = slugify(intersection.title) + intersection.save() + diff --git a/gstudio/admin/nodespecification.py b/gstudio/admin/nodespecification.py index f55bd05..0be8878 100644 --- a/gstudio/admin/nodespecification.py +++ b/gstudio/admin/nodespecification.py @@ -1,6 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import slugify from gstudio.admin.forms import NodeSpecificationAdminForm import reversion @@ -11,4 +12,11 @@ else: parent_class = admin.ModelAdmin class NodeSpecificationAdmin(parent_class): - pass + fieldsets=((_('NodeSpecification'),{'fields': ('metatypes','title','relations','attributes','subject','slug')}), + ) + prepopulated_fields = {'slug': ('title', )} + def save_model(self, request,nodespecification, form, change): + #nodespecification.title = nodespecification.composed_subject + nodespecification.slug = slugify(nodespecification.title) + nodespecification.save() + diff --git a/gstudio/admin/relation.py b/gstudio/admin/relation.py index 264a21b..fe7b083 100644 --- a/gstudio/admin/relation.py +++ b/gstudio/admin/relation.py @@ -15,7 +15,7 @@ else: parent_class = admin.ModelAdmin class RelationAdmin(parent_class): - fieldsets=((_('Relation'),{'fields': ('relationtype','relationtype_scope','left_subject' ,'left_subject_scope','right_subject','right_subject_scope')}), + fieldsets=((_('Relation'),{'fields': ('relationtype','relationtype_scope','left_subject' ,'left_subject_scope','right_subject','right_subject_scope','metatypes')}), ) diff --git a/gstudio/admin/relationspecification.py b/gstudio/admin/relationspecification.py index 6018236..8f57dc1 100644 --- a/gstudio/admin/relationspecification.py +++ b/gstudio/admin/relationspecification.py @@ -1,6 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import slugify from gstudio.admin.forms import RelationSpecificationAdminForm import reversion @@ -12,4 +13,12 @@ else: parent_class = admin.ModelAdmin class RelationSpecificationAdmin(parent_class): - pass + fieldsets=((_('RelationSpecification'),{'fields': ('metatypes','title','relationtype','subjects','slug')}), + ) + prepopulated_fields = {'slug': ('title', )} + def save_model(self, request,relationspecification, form, change): + #relationspecification.title = relationspecification.composed_subject + relationspecification.slug = slugify(relationspecification.title) + relationspecification.save() + + diff --git a/gstudio/admin/union.py b/gstudio/admin/union.py index d9bc092..5875c6a 100644 --- a/gstudio/admin/union.py +++ b/gstudio/admin/union.py @@ -1,6 +1,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import slugify from gstudio.admin.forms import UnionAdminForm from gstudio.settings import GSTUDIO_VERSIONING @@ -12,4 +13,10 @@ else: parent_class = admin.ModelAdmin class UnionAdmin(parent_class): - pass + fieldsets=((_('Union'),{'fields': ('metatypes','title','nodetypes','slug')}), + ) + prepopulated_fields = {'slug': ('title', )} + def save_model(self, request,union, form, change): + #union.title = union.composed_sentence + union.slug = slugify(union.title) + union.save() diff --git a/gstudio/models.py b/gstudio/models.py index a427b94..e98f4b7 100644 --- a/gstudio/models.py +++ b/gstudio/models.py @@ -101,10 +101,9 @@ import ast NODETYPE_CHOICES = ( ('ND', 'Nodes'), - ( 'OB' ,'Objects'), + ('OB' ,'Objects'), ('ED', 'Edges'), ('NT', 'Node types'), - ('ET', 'Edge types'), ('OT', 'Object types'), ('RT', 'Relation types'), ('MT', 'Metatypes'), @@ -439,7 +438,10 @@ class Node(NID): published = NodePublishedManager() def __unicode__(self): - return self.title + title=self.title + modelname=self.nodemodel + displayname=modelname+": "+title + return displayname class Meta: abstract=False @@ -447,21 +449,6 @@ class Node(NID): -class Edge(NID): - - - def __unicode__(self): - return self.title - - class Meta: - abstract=False - def save(self, *args, **kwargs): - if GSTUDIO_VERSIONING: - with reversion.create_revision(): - super(Edge, self).save(*args, **kwargs) # Call the "real" save() method. - - super(Edge, self).save(*args, **kwargs) # Call the "real" save() method. - class Metatype(Node): @@ -636,7 +623,8 @@ class Metatype(Node): return self.slug def __unicode__(self): - return self.title + displayname="MT: "+self.title + return displayname @property def composed_sentence(self): @@ -661,16 +649,32 @@ class Metatype(Node): # Save for metatype def save(self, *args, **kwargs): + self.nodemodel = self.__class__.__name__ + self.nbhood=[] super(Metatype, self).save(*args, **kwargs) # Call the "real" save() method. - self.nbhood=self.get_rendered_nbh - if GSTUDIO_VERSIONING: with reversion.create_revision(): super(Metatype, self).save(*args, **kwargs) # Call the "real" save() method. +class Edge(NID): + + metatypes = models.ManyToManyField(Metatype, verbose_name=_('member of metatypes'), + related_name='member_edges', + blank=True, null=True) + + def __unicode__(self): + displayname="ED: " + self.title + return displayname + class Meta: + """ Meta class for Edge """ + def save(self, *args, **kwargs): + if GSTUDIO_VERSIONING: + with reversion.create_revision(): + super(Edge, self).save(*args, **kwargs) # Call the "real" save() method. + super(Edge, self).save(*args, **kwargs) # Call the "real" save() method. @@ -1259,7 +1263,8 @@ class Nodetype(Node): return get_url_shortener()(self) def __unicode__(self): - return self.title + displayname="NT: "+self.title + return displayname @property def memberof_sentence(self): @@ -1320,7 +1325,8 @@ class Objecttype(Nodetype): ''' def __unicode__(self): - return self.title + displayname="OT: "+self.title + return displayname @property @@ -1669,7 +1675,8 @@ class Relationtype(Nodetype): def __unicode__(self): - return self.title + displayname="RT: "+self.title + return displayname @property @@ -2022,7 +2029,8 @@ class Attributetype(Nodetype): def __unicode__(self): - return self.title + displayname="AT: "+self.title + return displayname @property @@ -2110,8 +2118,8 @@ class Relation(Edge): def __unicode__(self): - return self.composed_sentence - + displayname="RN: "+self.composed_sentence + return displayname @property def composed_sentence(self): "composes the relation as a sentence in a triple format." @@ -2155,7 +2163,7 @@ class Relation(Edge): left_subject and right_subject should be saved after creating the relation """ self.nodemodel = self.__class__.__name__ - + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(Relation, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2202,7 +2210,8 @@ class Attribute(Edge): def __unicode__(self): - return self.composed_attribution + displayname="AS: "+self.composed_attribution + return displayname @property def edge_node_dict(self): @@ -2245,6 +2254,7 @@ class Attribute(Edge): def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(Attribute, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2260,13 +2270,14 @@ class AttributeCharField(Attribute): value = models.CharField(max_length=100, verbose_name='string') def __unicode__(self): - return self.title + displayname="ACF: "+ self.title + return displayname # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ - + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeCharField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2281,11 +2292,13 @@ class AttributeTextField(Attribute): value = models.TextField(verbose_name='text') def __unicode__(self): - return self.title + displayname="ATF: "+ self.title + return displayname # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeTextField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2298,11 +2311,13 @@ class AttributeIntegerField(Attribute): value = models.IntegerField(max_length=100, verbose_name='Integer') def __unicode__(self): - return self.title + displayname="AIF: "+self.title + return displayname # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeIntegerField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2317,11 +2332,14 @@ class AttributeCommaSeparatedIntegerField(Attribute): value = models.CommaSeparatedIntegerField(max_length=100, verbose_name='integers separated by comma') def __unicode__(self): - return self.title + displayname="ACSIF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeCommaSeparatedIntegerField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2334,11 +2352,14 @@ class AttributeBigIntegerField(Attribute): value = models.BigIntegerField(max_length=100, verbose_name='big integer') def __unicode__(self): - return self.title + displayname="ABIF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeBigIntegerField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2352,11 +2373,14 @@ class AttributePositiveIntegerField(Attribute): value = models.PositiveIntegerField(max_length=100, verbose_name='positive integer') def __unicode__(self): - return self.title + displayname="APIF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributePositiveIntegerField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2370,9 +2394,12 @@ class AttributeDecimalField(Attribute): value = models.DecimalField(max_digits=3, decimal_places=2, verbose_name='decimal') def __unicode__(self): - return self.title + displayname="ADF: "+self.title + return displayname + def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeDecimalField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2385,11 +2412,14 @@ class AttributeFloatField(Attribute): value = models.FloatField(max_length=100, verbose_name='number as float') def __unicode__(self): - return self.title + displayname="AFF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeFloatField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2403,9 +2433,12 @@ class AttributeBooleanField(Attribute): value = models.BooleanField(verbose_name='boolean') def __unicode__(self): - return self.title + displayname="ABF: "+self.title + return displayname + def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeBooleanField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2419,11 +2452,14 @@ class AttributeNullBooleanField(Attribute): value = models.NullBooleanField(verbose_name='true false or unknown') def __unicode__(self): - return self.title + displayname="ANBF: "+self.title + return displayname + def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeNullBooleanField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2437,10 +2473,14 @@ class AttributeDateField(Attribute): value = models.DateField(max_length=100, verbose_name='date') def __unicode__(self): - return self.title + displayname="ADF: "+self.title + return displayname + def save(self, *args, **kwargs): + self.nodemodel=self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeDateField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2454,11 +2494,14 @@ class AttributeDateTimeField(Attribute): value = models.DateTimeField(max_length=100, verbose_name='date time') def __unicode__(self): - return self.title + displayname="ADTF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeDateTimeField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2472,11 +2515,14 @@ class AttributeTimeField(Attribute): value = models.TimeField(max_length=100, verbose_name='time') def __unicode__(self): - return self.title + displayname="ATIF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeTimeField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2490,10 +2536,14 @@ class AttributeEmailField(Attribute): value = models.EmailField(max_length=100,verbose_name='value') def __unicode__(self): - return self.title + displayname="AEF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): + self.nodemodel=self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeEmailField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2507,11 +2557,14 @@ class AttributeFileField(Attribute): value = models.FileField(upload_to='media/'+UPLOAD_TO, verbose_name='file') def __unicode__(self): - return self.title + displayname="AFIF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeFileField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2525,11 +2578,14 @@ class AttributeFilePathField(Attribute): value = models.FilePathField(verbose_name='path of file') def __unicode__(self): - return self.title + displayname="AFPF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeFilePathField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2543,11 +2599,14 @@ class AttributeImageField(Attribute): value = models.ImageField(upload_to = UPLOAD_TO, verbose_name='image') def __unicode__(self): - return self.title + displayname="AIMF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeImageField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2561,11 +2620,14 @@ class AttributeURLField(Attribute): value = models.URLField(max_length=100, verbose_name='url') def __unicode__(self): - return self.title + displayname="AURLF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeURLField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2579,11 +2641,14 @@ class AttributeIPAddressField(Attribute): value = models.IPAddressField(max_length=100, verbose_name='ip address') def __unicode__(self): - return self.title + displayname="AIPF: "+self.title + return displayname + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeIPAddressField, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2608,7 +2673,9 @@ class Processtype(Nodetype): def __unicode__(self): - return self.title + displayname="PT: "+self.title + return displayname + class Meta: verbose_name = _('process type') @@ -2653,7 +2720,9 @@ class Systemtype(Nodetype): def __unicode__(self): - return self.title + displayname="ST: "+self.title + return displayname + class Meta: verbose_name = _('system type') @@ -2664,6 +2733,7 @@ class Systemtype(Nodetype): # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] super(Systemtype, self).save(*args, **kwargs) # Call the "real" save() method. # self.nbhood=self.get_rendered_nbh if GSTUDIO_VERSIONING: @@ -2680,7 +2750,9 @@ class AttributeSpecification(Node): """ attributetype = models.ForeignKey(Attributetype, verbose_name='property name') subjects = models.ManyToManyField(NID, related_name="subjects_attrspec_of", verbose_name='subjects') - + metatypes=models.ManyToManyField(Metatype,verbose_name=_('member of metatypes'), + related_name='member_attspecns', + blank=True, null=True) @property def composed_subject(self): @@ -2694,8 +2766,9 @@ class AttributeSpecification(Node): def __unicode__(self): - self.nodemodel = self.__class__.__name__ - return self.composed_subject + displayname="ASN: "+self.composed_subject + return displayname + class Meta: @@ -2706,6 +2779,7 @@ class AttributeSpecification(Node): # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(AttributeSpecification, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2721,6 +2795,9 @@ class RelationSpecification(Node): """ relationtype = models.ForeignKey(Relationtype, verbose_name='relation name') subjects = models.ManyToManyField(NID, related_name="subjects_in_relspec", verbose_name='subjects') + metatypes=models.ManyToManyField(Metatype,verbose_name=_('member of metatypes'), + related_name='member_relnspecns', + blank=True, null=True) @property @@ -2734,8 +2811,8 @@ class RelationSpecification(Node): return u'the %s of %s' % (self.relationtype, subjects) def __unicode__(self): - return self.composed_subject - + dispalyname="RSN: "+ self.composed_subject + return displayname class Meta: @@ -2746,6 +2823,7 @@ class RelationSpecification(Node): # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(RelationSpecification, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2761,6 +2839,10 @@ class NodeSpecification(Node): subject = models.ForeignKey(Node, related_name="subject_nodespec", verbose_name='subject name') relations = models.ManyToManyField(Relation, related_name="relations_in_nodespec", verbose_name='relations used to specify the domain') attributes = models.ManyToManyField(Attribute, related_name="attributes_in_nodespec", verbose_name='attributes used to specify the domain') + metatypes=models.ManyToManyField(Metatype,verbose_name=_('member of metatypes'), + related_name='member_nodespecns', + blank=True, null=True) + @property def composed_subject(self): @@ -2776,8 +2858,8 @@ class NodeSpecification(Node): return u'the %s with %s, %s' % (self.subject, self.relations, self.attributes) def __unicode__(self): - return self.composed_subject - + displayname="NSN: "+ self.composed_subject + return displayname class Meta: verbose_name = _('Node specification') @@ -2787,6 +2869,7 @@ class NodeSpecification(Node): # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(NodeSpecification, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2804,10 +2887,14 @@ class Expression(Node): left_term = models.ForeignKey(NID, related_name="left_term_of", verbose_name='left term name') relationtype = models.ForeignKey(Relationtype, verbose_name='relation name') right_term = models.ForeignKey(NID, related_name="right_term_of", verbose_name='right term name') + metatypes=models.ManyToManyField(Metatype,verbose_name=_('member of metatypes'), + related_name='member_exprn', + blank=True, null=True) def __unicode__(self): - return self.composed_sentence + displayname="EXPN: "+self.composed_sentence + return displayname @property def composed_sentence(self): @@ -2818,13 +2905,14 @@ class Expression(Node): class Meta: unique_together = (('left_term','relationtype','right_term'),) verbose_name = _('expression') - verbose_name_plural = _('expressionss') + verbose_name_plural = _('expressions') permissions = (('can_view_all', 'Can view all'), ('can_change_author', 'Can change author'), ) # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(Expression, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2839,13 +2927,24 @@ class Union(Node): union of two classes """ nodetypes = models.ManyToManyField(Nodetype, related_name = 'union_of', verbose_name='node types for union') + metatypes=models.ManyToManyField(Metatype,verbose_name=_('member of metatypes'), + related_name='member_unions', + blank=True, null=True) + def __unicode__(self): - return self.title + displayname="UN: "+ self.title + return displayname + + @property + def composed_sentence(self): + "composes the relation as a sentence in a triple format." + return u'%s %s' % (self.nodetypes, self.metatypes) # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(Union, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2860,13 +2959,26 @@ class Complement(Node): complement of a class """ nodetypes = models.ManyToManyField(Nodetype, related_name = 'complement_of', verbose_name='complementary nodes') + metatypes=models.ManyToManyField(Metatype,related_name='meta_complement',verbose_name=_('Metanodes'), + blank=True, null= True) + + @property + def composed_subject(self): + return u'Not of %s' % (self.nodetypes) + # @property + # def composed_sentence(self): + # "composes the complement as a sentence. " + # return u'Not of %s %s' % (self.nodetypes,self.metatypes) + def __unicode__(self): - return self.title + displayname="CMP: "+self.title + return displayname # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(Complement, self).save(*args, **kwargs) # Call the "real" save() method. @@ -2879,13 +2991,23 @@ class Intersection(Node): Intersection of classes """ nodetypes = models.ManyToManyField(Nodetype, related_name = 'intersection_of', verbose_name='intersection of classes') + metatypes=models.ManyToManyField(Metatype,verbose_name=_('member of metatypes'), + related_name='member_intersectn', + blank=True, null=True) + def __unicode__(self): - return self.title + displayname="INTSN: "+self.title + return displayname + @property + def composed_subject(self): + return u'And of %s' % (self.nodetypes) + # @reversion.create_revision() def save(self, *args, **kwargs): self.nodemodel = self.__class__.__name__ + self.nbhood=[] if GSTUDIO_VERSIONING: with reversion.create_revision(): super(Intersection, self).save(*args, **kwargs) # Call the "real" save() method. |