class Meta: model = StratigraphicLog fields = ('id', 'reference_elevation', 'top_depth', 'bottom_depth', 'material', 'stratigraphic_unit') widgets = { 'top_depth': QuantityInput(unit_group='length'), 'bottom_depth': QuantityInput(unit_group='length'), }
class Meta: model = ConstructionStructure fields = ('id', 'type', 'reference_elevation', 'top_depth', 'bottom_depth', 'diameter', 'material', 'description') widgets = { 'top_depth': QuantityInput(unit_group='length'), 'bottom_depth': QuantityInput(unit_group='length'), 'diameter': QuantityInput(unit_group='length', attrs={'min': 0}), }
class Meta: model = PumpingTest fields = ('porosity', 'hydraulic_conductivity', 'transmissivity', 'specific_storage', 'specific_yield', 'storativity', 'specific_capacity', 'test_type') widgets = { 'hydraulic_conductivity': QuantityInput(unit_group='length / time'), 'transmissivity': QuantityInput(unit_group='length^2 / time'), 'specific_storage': QuantityInput(unit_group='1 / length'), 'specific_capacity': QuantityInput(unit_group='length^2 / time'), 'storativity': QuantityInput(unit_group='length^3 / time'), }
class Meta: model = Geology fields = ('total_depth', 'reference_elevation') widgets = { 'total_depth': QuantityInput(unit_group='length', attrs={'min': 0}), }
def __init__(self, *args, **kwargs): forms.ModelForm.__init__(self, *args, **kwargs) for field_name, field in self.fields.items(): try: field.help_text = FormHelpText.objects.get( form=self.__class__.__name__, field=field_name).help_text except FormHelpText.DoesNotExist: pass # check the id of quantity field try: data = args[0] for field_name, field in self.fields.items(): if field.widget.__class__ == QuantityInput: data = QuantityInput.quantity_id(data, kwargs['instance'], field_name) except (KeyError, IndexError): pass
class Meta: model = WellLevelMeasurement fields = ('id', 'time', 'parameter', 'methodology', 'value', 'info') widgets = { 'value': QuantityInput() }
class Meta: model = ReferenceElevation fields = ('value', 'description') widgets = {'value': QuantityInput(unit_group='length')}
class Meta: model = WellLevelMeasurement fields = ('id', 'time', 'parameter', 'methodology', 'value') widgets = {'value': QuantityInput(unit_required=False)}