Editor: edit & delete features
This commit is contained in:
parent
6ce96148d7
commit
576b33fd1a
13 changed files with 239 additions and 31 deletions
|
@ -17,6 +17,7 @@ class FeatureForm(ModelForm):
|
|||
|
||||
titles = OrderedDict((lang_code, '') for lang_code, language in settings.LANGUAGES)
|
||||
if self.instance is not None and self.instance.pk:
|
||||
self.fields['name'].widget.attrs['readonly'] = True
|
||||
titles.update(self.instance.titles)
|
||||
|
||||
language_titles = dict(settings.LANGUAGES)
|
||||
|
@ -35,6 +36,14 @@ class FeatureForm(ModelForm):
|
|||
_('You have to select a title in at least one language.')
|
||||
)
|
||||
|
||||
def clean_name(self):
|
||||
if self.instance is not None and self.instance.pk and self.cleaned_data['name'] != self.instance.name:
|
||||
raise ValidationError(
|
||||
_('You cannot edit feature identifiers of existing objects.')
|
||||
)
|
||||
|
||||
return self.cleaned_data['name']
|
||||
|
||||
def get_languages(self):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue