-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
23 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from .models import Postcard | ||
from autofixture import generators, register, AutoFixture | ||
|
||
|
||
class PostcardAutoFixture(AutoFixture): | ||
|
||
default_cover_sizes = ( | ||
(800, 600), | ||
(600, 800), | ||
(1200, 600), | ||
(600, 1200), | ||
(1000, 1000), | ||
) | ||
|
||
field_values = { | ||
'cover': generators.ImageGenerator(sizes=default_cover_sizes), | ||
} | ||
|
||
register(Postcard, PostcardAutoFixture) |
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,7 +1,8 @@ | ||
from django.db import models | ||
|
||
|
||
class Postcard(models.Model): | ||
# didn't use TextField here because Django doesn't check max length for textField? | ||
message = models.CharField('Message', max_length=140, default="Hello!") | ||
cover = models.ImageField('Cover') | ||
sender = models.CharField('Sender', max_length=20, default="demo") | ||
sender = models.CharField('Sender', max_length=20, default="demo") |