Browse Source

Move comment from value to placeholder in HTML form

devel
bashmak 8 years ago
parent
commit
9ce218fe0c
  1. 11
      devapp/forms.py
  2. 2
      djing/local_settings.py.template

11
devapp/forms.py

@ -9,6 +9,17 @@ from djing import MAC_ADDR_REGEX, IP_ADDR_REGEX
class DeviceForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
"""
Move comment from value to placeholder in HTML form
"""
initial = kwargs.get('initial')
comment = initial.get('comment')
del initial['comment']
super(DeviceForm, self).__init__(*args, **kwargs)
self.fields['comment'].widget.attrs['placeholder'] = comment
mac_addr = forms.CharField(widget=forms.TextInput(attrs={
'pattern': MAC_ADDR_REGEX,
'required': True

2
djing/local_settings.py.template

@ -4,7 +4,7 @@ Custom settings for each system
DEBUG = True
ALLOWED_HOSTS = ['*']
ALLOWED_HOSTS = '*',
DEFAULT_FROM_EMAIL = 'admin@yoursite.com'

Loading…
Cancel
Save