Commit e0c3b564 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

Set unique together resource name and service

parent 180ad7d5
......@@ -157,12 +157,15 @@ class ResourceMetadata(models.Model):
class Resource(models.Model):
name = models.CharField(_('Name'), max_length=255, unique=True, db_index=True)
name = models.CharField(_('Name'), max_length=255)
meta = models.ManyToManyField(ResourceMetadata)
service = models.ForeignKey(Service)
desc = models.TextField(_('Description'), null=True)
unit = models.CharField(_('Name'), null=True, max_length=255)
group = models.CharField(_('Group'), null=True, max_length=255)
class Meta:
unique_together = ("name", "service")
def __str__(self):
return '%s%s%s' % (self.service, RESOURCE_SEPARATOR,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment