mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-13 13:12:42 +00:00
Implement proper mergeing of organisations
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
from django import forms
|
||||
from django.forms import ValidationError
|
||||
|
||||
from models import Organisation
|
||||
|
||||
@ -7,3 +8,11 @@ class OrganisationForm(forms.ModelForm):
|
||||
model = Organisation
|
||||
exclude = ('lastconfirmed', 'approved', 'managers', )
|
||||
|
||||
class MergeOrgsForm(forms.Form):
|
||||
merge_into = forms.ModelChoiceField(queryset=Organisation.objects.all())
|
||||
merge_from = forms.ModelChoiceField(queryset=Organisation.objects.all())
|
||||
|
||||
def clean(self):
|
||||
if self.cleaned_data['merge_into'] == self.cleaned_data['merge_from']:
|
||||
raise ValidationError("The two organisations selected must be different!")
|
||||
return self.cleaned_data
|
||||
|
Reference in New Issue
Block a user