forked from EGCETSII/decide_django_2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request EGCETSII#13 from Full-Tortuga/feature/5-migracion_…
…mongodb Feature/5 migracion mongodb
- Loading branch information
Showing
27 changed files
with
176 additions
and
500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
from django.db import models | ||
from django.core.exceptions import ValidationError | ||
|
||
|
||
class Census(models.Model): | ||
voting_id = models.PositiveIntegerField() | ||
voter_id = models.PositiveIntegerField() | ||
|
||
class Meta: | ||
unique_together = (('voting_id', 'voter_id'),) | ||
#A new census is valid if the pair is not already in the database | ||
def clean(self): | ||
# Don't allow draft entries to have a pub_date. | ||
if Census.objects.filter(voting_id=self.voting_id, voter_id=self.voter_id).exists(): | ||
raise ValidationError('There is already exists this pair', code='Error') |
Oops, something went wrong.