Skip to content

Commit

Permalink
Make event names unique.
Browse files Browse the repository at this point in the history
Fixes #329
  • Loading branch information
necessary129 committed Jan 3, 2017
1 parent 3804832 commit c07ea87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vms/event/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class Meta:
]

def clean(self):
start_date = self.cleaned_data.get('start_date')
end_date = self.cleaned_data.get('end_date')
cleaned_data = super(EventForm, self).clean()
start_date = cleaned_data.get('start_date')
end_date = cleaned_data.get('end_date')

if start_date and end_date:
if start_date > end_date:
Expand Down
1 change: 1 addition & 0 deletions vms/event/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Event(models.Model):
r'^[(A-Z)|(a-z)|(0-9)|(\s)|(\.)|(,)|(\-)|(!)|(\')]+$',
),
],
unique=True
)
start_date = models.DateField()
end_date = models.DateField()
Expand Down

0 comments on commit c07ea87

Please # to comment.