73 lines
2.1 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2013-12-15 17:09:22 +01:00
"""
form definitions (which fields are available, order, autofocus, ...)
"""
from django import forms
2014-09-25 20:15:18 +02:00
from .models import Host, RelatedHost, Domain, ServiceUpdaterHostConfig
2013-09-29 01:21:44 +02:00
class CreateHostForm(forms.ModelForm):
2013-10-03 17:21:18 +02:00
class Meta(object):
model = Host
fields = ['name', 'domain', 'comment']
widgets = {
'name': forms.widgets.TextInput(attrs=dict(autofocus=None)),
}
class EditHostForm(forms.ModelForm):
2013-10-03 17:21:18 +02:00
class Meta(object):
model = Host
fields = ['comment', 'available', 'abuse']
2014-09-25 20:15:18 +02:00
class CreateRelatedHostForm(forms.ModelForm):
class Meta(object):
model = RelatedHost
fields = ['name', 'available', 'interface_id_ipv4', 'interface_id_ipv6']
widgets = {
'name': forms.widgets.TextInput(attrs=dict(autofocus=None)),
}
class EditRelatedHostForm(forms.ModelForm):
class Meta(object):
model = RelatedHost
fields = ['name', 'available', 'interface_id_ipv4', 'interface_id_ipv6']
class CreateDomainForm(forms.ModelForm):
class Meta(object):
model = Domain
fields = ['name', 'nameserver_ip', 'nameserver_update_algorithm',
'public', 'available', 'comment']
widgets = {
'name': forms.widgets.TextInput(attrs=dict(autofocus=None)),
}
class EditDomainForm(forms.ModelForm):
class Meta(object):
model = Domain
2013-11-02 12:37:27 +01:00
fields = ['comment', 'nameserver_ip', 'public', 'available',
'nameserver_update_algorithm', 'nameserver_update_secret']
class CreateUpdaterHostConfigForm(forms.ModelForm):
class Meta(object):
model = ServiceUpdaterHostConfig
fields = ['service', 'hostname', 'name', 'password',
'give_ipv4', 'give_ipv6', 'comment']
widgets = {
'hostname': forms.widgets.TextInput(attrs=dict(autofocus=None)),
}
class EditUpdaterHostConfigForm(forms.ModelForm):
class Meta(object):
model = ServiceUpdaterHostConfig
fields = ['hostname', 'comment', 'name', 'password',
'give_ipv4', 'give_ipv6']