entity names are only unique by type

This commit is contained in:
j 2015-02-06 12:42:19 +05:30
commit d492619be6
3 changed files with 5 additions and 5 deletions

View file

@ -63,8 +63,8 @@ class Entity(models.Model):
return cls.objects.get(pk=ox.fromAZ(id))
@classmethod
def get_by_name(cls, name):
return cls.objects.get(name_find__icontains=u'|%s|'%name)
def get_by_name(cls, name, type):
return cls.objects.get(name_find__icontains=u'|%s|'%name, type=type)
@classmethod
def get_or_create(model, name):