models py from djast asterisk models import class Device models Model

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#models.py
from djast.asterisk.models import *
class Device(models.Model):
#описание класса Device
class Line(models.Model):
name = models.CharField(max_length=20)
number = models.IntegerField()
device = models.ForeignKey(Device)
sip = models.ForeignKey('asterisk.Sip', unique=True)
class Meta:
unique_together = [('device', 'number')]
def __unicode__(self):
return '%s %s' % (self.name, self.sip)
#admin.py
class LineAdmin(admin.ModelAdmin):
list_display = ('name', 'number', 'device', 'sip')
list_display_links = ('name',)
ordering = ['name']
list_per_page = 100
search_fields = ['name']