Commit 5b11e755 by Őry Máté

dashboard: allow setting description at group creation

parent 9deb2f3b
...@@ -315,6 +315,9 @@ class VmCustomizeForm(forms.Form): ...@@ -315,6 +315,9 @@ class VmCustomizeForm(forms.Form):
class GroupCreateForm(forms.ModelForm): class GroupCreateForm(forms.ModelForm):
description = forms.CharField(label=_("Description"), required=False,
widget=forms.Textarea(attrs={'rows': 3}))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
new_groups = kwargs.pop('new_groups', None) new_groups = kwargs.pop('new_groups', None)
super(GroupCreateForm, self).__init__(*args, **kwargs) super(GroupCreateForm, self).__init__(*args, **kwargs)
...@@ -332,11 +335,11 @@ class GroupCreateForm(forms.ModelForm): ...@@ -332,11 +335,11 @@ class GroupCreateForm(forms.ModelForm):
raise AttributeError('Committing is mandatory.') raise AttributeError('Committing is mandatory.')
group = super(GroupCreateForm, self).save() group = super(GroupCreateForm, self).save()
orgid = self.cleaned_data['org_id'] profile = group.profile
if orgid: # multiple blanks were not be unique unlike NULLs are
profile = group.profile profile.org_id = self.cleaned_data['org_id'] or None
profile.org_id = orgid profile.description = self.cleaned_data['description']
profile.save() profile.save()
return group return group
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment