Content Management/Models: Difference between revisions
Jump to navigation
Jump to search
(New page: <code>from django.db import models class Content(models.Model): title = models.CharField(max_length=200) path = models.CharField(max_length=256) date = models.DateTimeField('date added...) |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<code><pre> |
|||
from django.db import models |
|||
class Content(models.Model): |
class Content(models.Model): |
||
title = models.CharField( |
title = models.CharField(maxlength=200) |
||
path = models. |
path = models.FileField(upload_to='files', blank=True, null=True) |
||
date = models.DateTimeField('date added') |
date = models.DateTimeField('date added') |
||
confirmed = models.BooleanField() |
|||
def __str__(self): |
|||
return self.title + " (" + self.path + ")" |
|||
class Admin: |
|||
pass |
|||
class Tags(models.Model): |
|||
name = models.CharField(maxlength=200) |
|||
content = models.ManyToManyField(Content) |
|||
def __str__(self): |
|||
return self.name |
|||
</pre></code> |
|||
[[Category:Content Management]] |
Latest revision as of 03:28, 16 March 2008
from django.db import models
class Content(models.Model):
title = models.CharField(maxlength=200)
path = models.FileField(upload_to='files', blank=True, null=True)
date = models.DateTimeField('date added')
confirmed = models.BooleanField()
def __str__(self):
return self.title + " (" + self.path + ")"
class Admin:
pass
class Tags(models.Model):
name = models.CharField(maxlength=200)
content = models.ManyToManyField(Content)
def __str__(self):
return self.name