##// END OF EJS Templates
Configuration model changed: status and date fields were replaced by type and created fields....
Configuration model changed: status and date fields were replaced by type and created fields. git-svn-id: http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp@35 aa17d016-51d5-4e8b-934c-7b2bbb1bbe71

File last commit:

r13:6a2dde2f45c9
r21:484383ce85e5
Show More
forms.py
34 lines | 1.4 KiB | text/x-python | PythonLexer
Fiorella Quino
CGS model, form, view, url and html have been added....
r4 from django import forms
Miguel Urco
Campaign has been added to RadarSys Model...
r13 from apps.main.models import Device
Fiorella Quino
CGS model, form, view, url and html have been added....
r4 from .models import CGSConfiguration
class CGSConfigurationForm(forms.ModelForm):
#freq0.widget = te
def __init__(self, *args, **kwargs):
#request = kwargs.pop('request')
super(CGSConfigurationForm, self).__init__(*args, **kwargs)
Miguel Urco
Campaign has been added to RadarSys Model...
r13 instance = getattr(self, 'instance', None)
if instance and instance.pk:
devices = Device.objects.filter(device_type__name='cgs')
items = devices.values('id', 'name', 'device_type__name', 'ip_address')
self.fields['experiment'].widget.attrs['readonly'] = True
self.fields['device'].widget.choices = [(item['id'], '[%s]: %s | %s' % (item['device_type__name'], item['name'], item['ip_address'])) for item in items]
Fiorella Quino
CGS model, form, view, url and html have been added....
r4 def clean(self):
Miguel Urco
Campaign has been added to RadarSys Model...
r13 return
# # Custom validation to force an integer when type of unit = "Unit"
# form_data = self.cleaned_data
# if (form_data['freq0'] or form_data['freq1'] or form_data['freq2'] or form_data['freq3'] < 0):
# raise forms.ValidationError("Please introduce positive Number")
#
# return form_data
Fiorella Quino
CGS model, form, view, url and html have been added....
r4
class Meta:
model = CGSConfiguration
#exclude = ('freqs', 'clk_in', 'mult','div',)
Miguel Urco
CGS view updated...
r11 # exclude = ('freqs',)
Miguel Urco
Campaign has been added to RadarSys Model...
r13 fields = ('experiment', 'device', 'freq0', 'freq1', 'freq2', 'freq3')