def upload_location(instance, filename):
return "%s/%s" % (instance.id, filename)
class Post(models.Model):
user = models.ForeignKey(User, blank=True, null=True,
on_delete=models.CASCADE, default=1)
title = models.CharField('Título', max_length=120)
slug = models.SlugField(unique=True)
image = models.ImageField('Imagem', upload_to=upload_location,
null=True,
blank=True,
width_field="width_field",
height_field="height_field")
height_field = models.IntegerField(default=0)
width_field = models.IntegerField(default=0)
codigo_incorporacao = models.TextField('Código de Incorporação', null=True,
blank=True, max_length=240)
content = models.TextField()
draft = models.BooleanField(default=False)
publish = models.DateTimeField('Data', auto_now=False, auto_now_add=False)
read_time = models.IntegerField(default=0) # models.TimeField(null=True,
blank=True) #assume minutes
updated = models.DateTimeField(auto_now_add=False, auto_now=True)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
objects = PostManager()
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/6b66f535-7859-4c23-9755-f6a5e3eb8728%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.