Tuesday, July 22, 2014

template

can someone propose a good template for this model

# Create your models here.
from django.db import models

from django.contrib.auth.models import User
from django.contrib import admin

class Albums(models.Model):
    title = models.CharField(max_length=100)
    public = models.BooleanField(default=False)

    def __unicode__(self):
        return self.title

class Tags(models.Model):
    tag = models.CharField(max_length=100)

    def __unicode__(self):
        return self.tag

class Image(models.Model):
    title = models.CharField(max_length=60, blank=True, null=True)
    image = models.FileField(upload_to="gallery/images")
    tags = models.ManyToManyField(Tags, blank=True)
    albums = models.ManyToManyField(Albums, blank=True)
    created = models.DateTimeField(auto_now_add=True)
    rating = models.IntegerField(default=100)
    #width = models.IntegerField(blank=True, null=True)
    #height = models.IntegerField(blank=True, null=True)
    user = models.ForeignKey(User, null=True, blank=True)


    def __unicode__(self):
        return self.image.name

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a879583a-954a-4aa4-afd6-42b02220ac72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment