Add display type and sort by name to info items

This commit is contained in:
Juhana
2017-03-01 17:11:58 +02:00
parent 6834e4d940
commit 78f5111594
2 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -51,6 +51,7 @@ class InfoItem(models.Model):
'name': self.name,
'item_type': ContentType.objects.get_for_model(self).id,
'template_url': self.get_template_url(),
'display_name': self.display_name,
'create_template_url': self.get_create_template_url(),
'options': {}
}
@@ -99,7 +100,7 @@ class SossoInfoItem(InfoItem):
class ImageInfoItem(InfoItem):
display_name = _("Image upload")
display_name = _("Image")
img = models.ImageField(upload_to="infoimages/")
def get_template_url(self):
+3 -1
View File
@@ -36,12 +36,14 @@
<table class="table table-striped">
<tr>
<th>{% trans "Item" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Set duration" %}</th>
<th>{% trans "Add to rotation" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
<tr ng-repeat="i in infoitems">
<tr ng-repeat="i in infoitems | orderBy:['display_name','name']">
<td>{$ i.name $}</td>
<td>{$ i.display_name $}</td>
<td><input type="text" class="form-control" ng-model="i.duration"></input></td>
<td><input type="button" class="btn btn-success" ng-click="createInstance(selected_rot.id, i.id, i.item_type, i.duration);" value="{% trans "Add" %}"></input></td>
<td><input type="button" class="btn btn-danger" ng-click="deleteItem(i.item_type, i.id);" value="{% trans "Delete" %}"></input></td>