Hi,
I've been developping a link model (see at the end of the post, kind
of personal delicious) , and when I try to use the admin interface to
add a url, I obtain the following error:
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/links/link/
Exception Type: OperationalError
Exception Value: no such column: links_link.link
Exception Location: c:\program
files\python24\lib\site-packages\django-0.91-py2.4.egg\django\db\backends\sqlite3\base.py
in execute, line 69
It is really curious because the table seems to exist.
Another question, I've developped a quick tag model (see also at the
end). Would I be able to use the same tag model for, say, blog posts
and images at the same time? Or would I have to subclass or use
different implementation of the Tag class?
Thanks a lot.
G
The code:
LINK:
from django.db import models
from django.contrib.auth.models import User
from djangocode.sysvortex.tags.models import Tag
class Link(models.Model):
slug = models.SlugField(prepopulate_from=('title',),
help_text='Automatically built from the title',
primary_key=True)
link = models.URLField()
title = models.CharField(maxlength=79)
date = models.DateTimeField()
summary = models.TextField(blank=True,
help_text='Will be displayed on urls indexes')
tags = models.ManyToManyField(Tag,related_name='link_tagged')
author = models.ForeignKey(User)
def get_absolute_url(self):
return '/links/%s/' % self.slug
def get_tag_list(self):
return self.tags.all()
def __str__(self):
return self.title
def __repr__(self):
return self.title
class Admin:
list_display = ('title','url','date','author')
list_select_related = 'True'
search_fields = ['title','summary']
ordering = ('-date')
fields = (
(None, {'fields':('url','title','slug','author',
'date'), }),
(None, {'fields':('summary',),
'classes':'wide', }),
)
TAG:
class Tag(models.Model):
slug=models.SlugField(prepopulate_from=('title',),
help_text='Automatically built from the title',
primary_key=True)
title = models.CharField(maxlength=30)
description=models.CharField(maxlength=200,help_text='Short
summary of this tag')
def get_absolute_url(self):
return '/tags/%s/' % self.slug
def get_list(self):
return self.post_tagged.all()
def __str__(self):
return self.title
def __repr__(self):
return self.title
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---