2019-07-12 20:36:18 -06:00
|
|
|
"""SatNOGS DB django base Forms class"""
|
New SatNOGS DB user interface
Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far:
* Updated dependencies to latest 2.x django
* Updated to Bootstrap 4
* New home screen to display most recent satellite entries, most recent data, and contributors
* Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size
* Adopted AdminLTE 3.x framework atop Bootstrap 4
* Created reusable cards for satellite and transmitters
* Cards and Modals are organized into subdirectories for template includes and base templates, respectively
* New stats display widgets using BS4 and AdminLTE 3
* Satellite search is redesigned and now accessible from any page of the site
* Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view
* Focus on all UI scaling down to mobile devices
* New model created for Operator (/ Owner): name, names, description, website
* Added django-countries for support of CountryField
* Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime
* Transmitter suggestions can now be approved in the UI by superusers
* Satellite entries can now be edited in the UI by users with the change satellite permission
* Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size
* Other cleanup and changes that I'm missing for sure.
Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
|
|
|
from bootstrap_modal_forms.forms import BSModalModelForm
|
2019-04-04 21:46:30 -06:00
|
|
|
from django.core.exceptions import ValidationError
|
New SatNOGS DB user interface
Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far:
* Updated dependencies to latest 2.x django
* Updated to Bootstrap 4
* New home screen to display most recent satellite entries, most recent data, and contributors
* Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size
* Adopted AdminLTE 3.x framework atop Bootstrap 4
* Created reusable cards for satellite and transmitters
* Cards and Modals are organized into subdirectories for template includes and base templates, respectively
* New stats display widgets using BS4 and AdminLTE 3
* Satellite search is redesigned and now accessible from any page of the site
* Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view
* Focus on all UI scaling down to mobile devices
* New model created for Operator (/ Owner): name, names, description, website
* Added django-countries for support of CountryField
* Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime
* Transmitter suggestions can now be approved in the UI by superusers
* Satellite entries can now be edited in the UI by users with the change satellite permission
* Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size
* Other cleanup and changes that I'm missing for sure.
Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
|
|
|
from django.forms import NumberInput, TextInput
|
2019-04-04 21:46:30 -06:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2015-04-25 10:47:22 -06:00
|
|
|
|
New SatNOGS DB user interface
Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far:
* Updated dependencies to latest 2.x django
* Updated to Bootstrap 4
* New home screen to display most recent satellite entries, most recent data, and contributors
* Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size
* Adopted AdminLTE 3.x framework atop Bootstrap 4
* Created reusable cards for satellite and transmitters
* Cards and Modals are organized into subdirectories for template includes and base templates, respectively
* New stats display widgets using BS4 and AdminLTE 3
* Satellite search is redesigned and now accessible from any page of the site
* Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view
* Focus on all UI scaling down to mobile devices
* New model created for Operator (/ Owner): name, names, description, website
* Added django-countries for support of CountryField
* Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime
* Transmitter suggestions can now be approved in the UI by superusers
* Satellite entries can now be edited in the UI by users with the change satellite permission
* Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size
* Other cleanup and changes that I'm missing for sure.
Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
|
|
|
from db.base.models import Satellite, Transmitter, TransmitterEntry
|
2015-04-25 10:47:22 -06:00
|
|
|
|
|
|
|
|
2019-07-16 07:41:52 -06:00
|
|
|
def existing_uuid(value):
|
|
|
|
"""ensures the UUID is existing and valid"""
|
|
|
|
try:
|
|
|
|
Transmitter.objects.get(uuid=value)
|
|
|
|
except Transmitter.DoesNotExist:
|
|
|
|
raise ValidationError(
|
|
|
|
_('%(value)s is not a valid uuid'),
|
|
|
|
code='invalid',
|
|
|
|
params={'value': value},
|
|
|
|
)
|
|
|
|
|
|
|
|
|
New SatNOGS DB user interface
Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far:
* Updated dependencies to latest 2.x django
* Updated to Bootstrap 4
* New home screen to display most recent satellite entries, most recent data, and contributors
* Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size
* Adopted AdminLTE 3.x framework atop Bootstrap 4
* Created reusable cards for satellite and transmitters
* Cards and Modals are organized into subdirectories for template includes and base templates, respectively
* New stats display widgets using BS4 and AdminLTE 3
* Satellite search is redesigned and now accessible from any page of the site
* Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view
* Focus on all UI scaling down to mobile devices
* New model created for Operator (/ Owner): name, names, description, website
* Added django-countries for support of CountryField
* Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime
* Transmitter suggestions can now be approved in the UI by superusers
* Satellite entries can now be edited in the UI by users with the change satellite permission
* Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size
* Other cleanup and changes that I'm missing for sure.
Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
|
|
|
class TransmitterModelForm(BSModalModelForm): # pylint: disable=too-many-ancestors
|
2019-07-12 20:36:18 -06:00
|
|
|
"""Model Form class for TransmitterEntry objects"""
|
2015-04-25 10:47:22 -06:00
|
|
|
class Meta:
|
2019-04-04 21:46:30 -06:00
|
|
|
model = TransmitterEntry
|
2019-07-13 19:05:38 -06:00
|
|
|
fields = [
|
|
|
|
'description', 'status', 'type', 'uplink_low', 'uplink_high', 'downlink_low',
|
2019-11-09 03:09:41 -07:00
|
|
|
'downlink_high', 'uplink_drift', 'downlink_drift', 'downlink_mode', 'uplink_mode',
|
New SatNOGS DB user interface
Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far:
* Updated dependencies to latest 2.x django
* Updated to Bootstrap 4
* New home screen to display most recent satellite entries, most recent data, and contributors
* Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size
* Adopted AdminLTE 3.x framework atop Bootstrap 4
* Created reusable cards for satellite and transmitters
* Cards and Modals are organized into subdirectories for template includes and base templates, respectively
* New stats display widgets using BS4 and AdminLTE 3
* Satellite search is redesigned and now accessible from any page of the site
* Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view
* Focus on all UI scaling down to mobile devices
* New model created for Operator (/ Owner): name, names, description, website
* Added django-countries for support of CountryField
* Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime
* Transmitter suggestions can now be approved in the UI by superusers
* Satellite entries can now be edited in the UI by users with the change satellite permission
* Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size
* Other cleanup and changes that I'm missing for sure.
Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
|
|
|
'invert', 'baud', 'citation', 'service'
|
|
|
|
]
|
|
|
|
widgets = {
|
|
|
|
'description': TextInput(),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class TransmitterUpdateForm(BSModalModelForm): # pylint: disable=too-many-ancestors
|
|
|
|
"""Model Form class for TransmitterEntry objects"""
|
|
|
|
class Meta:
|
|
|
|
model = TransmitterEntry
|
|
|
|
fields = [
|
|
|
|
'description', 'status', 'type', 'service', 'uplink_low', 'uplink_drift',
|
|
|
|
'uplink_high', 'downlink_low', 'uplink_mode', 'downlink_drift', 'downlink_high',
|
|
|
|
'downlink_mode', 'invert', 'baud', 'created', 'citation'
|
|
|
|
]
|
|
|
|
widgets = {
|
|
|
|
'description': TextInput(),
|
|
|
|
'created': TextInput(attrs={'readonly': True}),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class SatelliteModelForm(BSModalModelForm):
|
|
|
|
"""Form that uses django-bootstrap-modal-forms for satellite editing"""
|
|
|
|
class Meta:
|
|
|
|
model = Satellite
|
|
|
|
fields = [
|
|
|
|
'norad_cat_id', 'name', 'names', 'operator', 'status', 'description', 'countries',
|
|
|
|
'website', 'dashboard_url', 'launched', 'deployed', 'decayed', 'image'
|
2019-07-13 19:05:38 -06:00
|
|
|
]
|
New SatNOGS DB user interface
Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far:
* Updated dependencies to latest 2.x django
* Updated to Bootstrap 4
* New home screen to display most recent satellite entries, most recent data, and contributors
* Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size
* Adopted AdminLTE 3.x framework atop Bootstrap 4
* Created reusable cards for satellite and transmitters
* Cards and Modals are organized into subdirectories for template includes and base templates, respectively
* New stats display widgets using BS4 and AdminLTE 3
* Satellite search is redesigned and now accessible from any page of the site
* Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view
* Focus on all UI scaling down to mobile devices
* New model created for Operator (/ Owner): name, names, description, website
* Added django-countries for support of CountryField
* Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime
* Transmitter suggestions can now be approved in the UI by superusers
* Satellite entries can now be edited in the UI by users with the change satellite permission
* Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size
* Other cleanup and changes that I'm missing for sure.
Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
|
|
|
labels = {
|
|
|
|
'norad_cat_id': _('Norad ID'),
|
|
|
|
'names': _('Other names'),
|
|
|
|
'countries': _('Countries of Origin'),
|
|
|
|
'launched': _('Launch Date'),
|
|
|
|
'deployed': _('Deploy Date'),
|
|
|
|
'decayed': _('Re-entry Date'),
|
|
|
|
'description': _('Description'),
|
|
|
|
'dashboard_url': _('Dashboard URL'),
|
|
|
|
'operator': _('Owner/Operator'),
|
|
|
|
}
|
|
|
|
widgets = {'norad_cat_id': NumberInput(attrs={'readonly': True}), 'names': TextInput()}
|