##// END OF EJS Templates
Location model added to RadarSys...
Location model added to RadarSys git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@62 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71

File last commit:

r41:4fd88f104093
r41:4fd88f104093
Show More
models.py
141 lines | 4.3 KiB | text/x-python | PythonLexer
Juan C. Espinoza
Proyecto base en Django (refs #259) ...
r0 from django.db import models
Juan C. Espinoza
Updating base models and views ...
r6 from polymorphic import PolymorphicModel
Juan C. Espinoza
Proyecto base en Django (refs #259) ...
r0
Miguel Urco
DDS app updated...
r32 from django.core.urlresolvers import reverse
Miguel Urco
Location model added to RadarSys...
r41 CONF_STATES = (
(0, 'Disconnected'),
(1, 'Connected'),
(1, 'Running'),
)
Miguel Urco
Configuration model changed: status and date fields were replaced by type and created fields....
r21 CONF_TYPES = (
Miguel Urco
status field added to Device and DevConfiguration model...
r16 (0, 'Active'),
Miguel Urco
Configuration model changed: status and date fields were replaced by type and created fields....
r21 (1, 'Historical'),
Miguel Urco
status field added to Device and DevConfiguration model...
r16 )
DEV_STATES = (
(0, 'No connected'),
(1, 'Connected'),
(2, 'Configured'),
(3, 'Running'),
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2 )
Miguel Urco
Campaign has been added to RadarSys Model...
r13 DEV_TYPES = (
('', 'Select a device type'),
('rc', 'Radar Controller'),
('dds', 'Direct Digital Synthesizer'),
Miguel Urco
models are passed as instances to templates (dictionaries are not used anymore)...
r22 ('jars', 'Jicamarca Radar Acquisition System'),
Miguel Urco
Campaign has been added to RadarSys Model...
r13 ('usrp', 'Universal Software Radio Peripheral'),
('cgs', 'Clock Generator System'),
('abs', 'Automatic Beam Switching'),
)
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
Miguel Urco
Campaign has been added to RadarSys Model...
r13 # Create your models here.
Miguel Urco
Location model added to RadarSys...
r41
class Location(models.Model):
name = models.CharField(max_length = 30)
description = models.TextField(blank=True, null=True)
class Meta:
db_table = 'db_location'
def __unicode__(self):
return u'%s' % self.name
Miguel Urco
Campaign has been added to RadarSys Model...
r13
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2 class DeviceType(models.Model):
Miguel Urco
Campaign has been added to RadarSys Model...
r13 name = models.CharField(max_length = 10, choices = DEV_TYPES, default = 'rc')
description = models.TextField(blank=True, null=True)
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
class Meta:
Miguel Urco
Campaign has been added to RadarSys Model...
r13 db_table = 'db_device_types'
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
def __unicode__(self):
Miguel Urco
models are passed as instances to templates (dictionaries are not used anymore)...
r22 return u'%s' % self.get_name_display()
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
class Device(models.Model):
device_type = models.ForeignKey(DeviceType)
Miguel Urco
Location model added to RadarSys...
r41 # location = models.ForeignKey(Location)
Miguel Urco
Device model changed: ...
r9 name = models.CharField(max_length=40, default='')
Juan C. Espinoza
Updating base models and views ...
r6 ip_address = models.GenericIPAddressField(protocol='IPv4', default='0.0.0.0')
Miguel Urco
Campaign has been added to RadarSys Model...
r13 port_address = models.PositiveSmallIntegerField(default=2000)
Miguel Urco
Device model changed: ...
r9 description = models.TextField(blank=True, null=True)
Miguel Urco
status field added to Device and DevConfiguration model...
r16 status = models.PositiveSmallIntegerField(default=0, choices=DEV_STATES)
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
class Meta:
Miguel Urco
Campaign has been added to RadarSys Model...
r13 db_table = 'db_devices'
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
def __unicode__(self):
Miguel Urco
models are passed as instances to templates (dictionaries are not used anymore)...
r22 return u'%s | %s' % (self.name, self.ip_address)
Miguel Urco
Campaign has been added to RadarSys Model...
r13
class Campaign(models.Model):
name = models.CharField(max_length=40, unique=True)
start_date = models.DateTimeField(blank=True, null=True)
end_date = models.DateTimeField(blank=True, null=True)
tags = models.CharField(max_length=40)
description = models.TextField(blank=True, null=True)
template = models.BooleanField(default=False)
class Meta:
db_table = 'db_campaigns'
def __unicode__(self):
Miguel Urco
models are passed as instances to templates (dictionaries are not used anymore)...
r22 return u'%s' % (self.name)
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
class Experiment(models.Model):
Miguel Urco
Campaign has been added to RadarSys Model...
r13 campaign = models.ForeignKey(Campaign)
name = models.CharField(max_length=40, default='')
start_time = models.TimeField(default='00:00:00')
end_time = models.TimeField(default='23:59:59')
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
class Meta:
Miguel Urco
Campaign has been added to RadarSys Model...
r13 db_table = 'db_experiments'
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
def __unicode__(self):
Miguel Urco
models are passed as instances to templates (dictionaries are not used anymore)...
r22 return u'[%s]: %s' % (self.campaign.name, self.name)
Juan C. Espinoza
Updating base models and views ...
r6
class Configuration(PolymorphicModel):
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
Juan C. Espinoza
Updating base models and views ...
r6 experiment = models.ForeignKey(Experiment)
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2 device = models.ForeignKey(Device)
Miguel Urco
Location model added to RadarSys...
r41
status = models.PositiveSmallIntegerField(default=0, choices=CONF_STATES)
Miguel Urco
Configuration model changed: status and date fields were replaced by type and created fields....
r21 type = models.PositiveSmallIntegerField(default=0, choices=CONF_TYPES)
Miguel Urco
status field added to Device and DevConfiguration model...
r16
Miguel Urco
Location model added to RadarSys...
r41 name = models.CharField(max_length=40, default='')
Miguel Urco
models are passed as instances to templates (dictionaries are not used anymore)...
r22 created_date = models.DateTimeField(auto_now_add=True)
programmed_date = models.DateTimeField(auto_now=True)
parameters = models.TextField(default='{}')
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2 class Meta:
Miguel Urco
Campaign has been added to RadarSys Model...
r13 db_table = 'db_configurations'
Juan C. Espinoza
Actualizacion de templates y modelos base #263...
r2
def __unicode__(self):
Miguel Urco
delete interface added to views...
r18 return u'[%s - %s]: %s' % (self.experiment.campaign.name,
self.experiment.name,
self.device.name)
Juan C. Espinoza
Add rc config mods...
r23 def get_absolute_url(self):
Miguel Urco
DDS app updated...
r32
Juan C. Espinoza
Add rc config mods...
r23 return reverse('url_%s_conf' % self.device.device_type.name, args=[str(self.id)])
Miguel Urco
Buttons "Import", "Export, "Read" and "Write" added to Configuration View...
r30
def get_absolute_url_edit(self):
return reverse('url_edit_%s_conf' % self.device.device_type.name, args=[str(self.id)])
def get_absolute_url_import(self):
return reverse('url_import_%s_conf' % self.device.device_type.name, args=[str(self.id)])
def get_absolute_url_export(self):
return reverse('url_export_%s_conf' % self.device.device_type.name, args=[str(self.id)])
def get_absolute_url_write(self):
return reverse('url_write_%s_conf' % self.device.device_type.name, args=[str(self.id)])
def get_absolute_url_read(self):
return reverse('url_read_%s_conf' % self.device.device_type.name, args=[str(self.id)])