admin
variable.admin
¤
Classes¤
PermissionsBaseAdmin
¤
Bases: GuardedModelAdmin
Base admin class for models that require permissions.
Functions¤
formfield_for_choice_field(db_field, request, **kwargs)
¤
Limit the queryset for choice fields.
Source code in management\admin.py
75 76 77 78 79 80 81 |
|
formfield_for_foreignkey(db_field, request, **kwargs)
¤
Limit the queryset for foreign key fields.
Source code in management\admin.py
66 67 68 69 70 71 72 73 |
|
get_queryset(request)
¤
Return a queryset of the objects that the user has view permissions for.
Source code in management\admin.py
59 60 61 62 63 64 |
|
has_change_permission(request, obj=None)
¤
Check if the user has the correct permission to change the object.
Source code in management\admin.py
23 24 25 26 27 28 29 |
|
has_delete_permission(request, obj=None)
¤
Check if the user has the correct permission to delete the object.
Source code in management\admin.py
31 32 33 34 35 |
|
has_view_permission(request, obj=None)
¤
Check if the user has the correct permission to view the object.
Source code in management\admin.py
37 38 39 40 41 42 |
|
obj_perms_manage_view(request, object_pk)
¤
Prevents permission scalation at object level.
Only allows users with change permissions for this object to change the object permissions.
Source code in management\admin.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
SensorInstallation
¤
Bases: PermissionsBase
Represents an installation of a Sensor at a Station, which measures a Variable.
It includes metadata for installation and finishing date, as well as state (active or not).
Attributes:
Name | Type | Description |
---|---|---|
sensorinstallation_id |
AutoField
|
Primary key. |
variable |
ForeignKey
|
Variable measured by the sensor. |
station |
ForeignKey
|
Station where the sensor is installed. |
sensor |
ForeignKey
|
Sensor used for the measurement. |
start_date |
DateField
|
Start date of the installation. |
end_date |
DateField
|
End date of the installation. |
state |
BooleanField
|
Is the sensor active? |
SensorInstallationAdmin
¤
SensorTypeAdmin
¤
Unit
¤
Bases: PermissionsBase
Unit of measurement with a name and a symbol.
Attributes:
Name | Type | Description |
---|---|---|
unit_id |
AutoField
|
Primary key. |
name |
CharField
|
Name of the unit, eg. meters per second. |
initials |
CharField
|
Symbol for the unit, eg. m/s. |
Functions¤
__str__()
¤
Return the string representation of the object.
Source code in variable\models.py
42 43 44 |
|
get_absolute_url()
¤
Get the absolute URL of the object.
Source code in variable\models.py
46 47 48 |
|
Variable
¤
Bases: PermissionsBase
A variable with a physical meaning.
Such as precipitation, wind speed, wind direction, soil moisture, including the associated unit. It also includes metadata to help identify what is a reasonable value for the data, to flag outliers and to help with the validation process.
The nature of the variable can be one of the following:
- sum: Cumulative value over a period of time.
- average: Average value over a period of time.
- value: One-off value.
Attributes:
Name | Type | Description |
---|---|---|
variable_id |
AutoField
|
Primary key. |
variable_code |
CharField
|
Code of the variable, eg. airtemperature. |
name |
CharField
|
Human-readable name of the variable, eg. Air temperature. |
unit |
ForeignKey
|
Unit of the variable. |
maximum |
DecimalField
|
Maximum value allowed for the variable. |
minimum |
DecimalField
|
Minimum value allowed for the variable. |
diff_error |
DecimalField
|
If two sequential values in the time-series data of this variable differ by more than this value, the validation process can mark this with an error flag. |
outlier_limit |
DecimalField
|
The statistical deviation for defining outliers, in times the standard deviation (sigma). |
null_limit |
DecimalField
|
The max % of null values (missing, caused by e.g. equipment malfunction) allowed for hourly, daily, monthly data. Cumulative values are not deemed trustworthy if the number of missing values in a given period is greater than the null_limit. |
nature |
CharField
|
Nature of the variable, eg. if it represents a one-off value, the average over a period of time or the cumulative value over a period |
Attributes¤
is_cumulative: bool
property
¤
Return True if the nature of the variable is sum.
Functions¤
__str__()
¤
Return the string representation of the object.
Source code in variable\models.py
165 166 167 |
|
clean()
¤
Validate the model fields.
Source code in variable\models.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
get_absolute_url()
¤
Get the absolute URL of the object.
Source code in variable\models.py
169 170 171 |
|