Commit 6625e283 by Őry Máté

one: add list_fields to all models

parent 006dcfa1
......@@ -98,8 +98,19 @@ class InstanceAdmin(contrib.admin.ModelAdmin):
class DiskAdmin(contrib.admin.ModelAdmin):
model=models.Disk
list_display = ('name', 'used_by')
def used_by(self, obj):
try:
return ", ".join(obj.template_set.all())
except:
return None
used_by.verbose_name = _('used by')
class NetworkAdmin(contrib.admin.ModelAdmin):
model=models.Network
list_display = ('name', 'nat', 'public', 'get_vlan')
class ShareAdmin(contrib.admin.ModelAdmin):
model=models.Network
list_filter = ('group', 'template', )
......
......@@ -300,6 +300,8 @@ class Network(models.Model):
Network(id=id, name=name).save()
l.append(id)
Network.objects.exclude(id__in=l).delete()
def get_vlan(self):
return Vlan.objects.get(vid=self.id)
class InstanceType(models.Model):
......
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 sign in to comment