Last active
August 29, 2015 13:56
-
-
Save eduardo-matos/8810337 to your computer and use it in GitHub Desktop.
Gerar valor aleatório para campos
This file contains hidden or 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
# coding: utf-8 | |
from django.db import models | |
from django.utils.crypto import get_random_string | |
from django.utils.translation import ugettext_lazy as _ | |
class Discount(models.Model): | |
discount = models.FloatField(_('Discount Value')) | |
code = models.CharField(_("Discount code"), max_length=255, unique=True, default=get_random_string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment