Have you tried resetting your database and syncing it again?
If there are columns missing it sounds like you added them after you
did a manage.py syncdb
Django will not alter your tables after they have been created. More
info on this here:
http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs#syncdb

So I would try:

python manage.py reset appname
python manage.py syncdb

Just keep in mind that you'll lose your previously stored data.

-Sævar

On Jul 9, 8:10 am, yugori <yuya.gor...@gmail.com> wrote:
> Hi, I'm beginner of Django&Py.
> Now I try to make Product Management Tool with Django.
> So I wrote some code.
>
> models.py
> //---
> from django import forms
> from django.db import models
>
> # ex('ie8','InternetExplorer8')
> class Browser(models.Model):
>   id=model.CharField('id',primary_key=True)
>   name=model.CharField('name')
>
>   def __unicode__(self):
>     return self.name
>
> # ex('iphone3','iPhoneOS3')
> class Device(models.Model):
>   id=model.CharField('id',primary_key=True)
>   name=model.CharField('name')
>
>   def __unicode__(self):
>     return self.name
>
> # ex('site01','MySite','browser[]','device[]')
> class Product(models.Model):
>   id = models.CharField('id', primary_key=True)
>   name = models.CharField('name')
>   support_browser = models.ManyToManyField(Browser)
>   support_device = models.ManyToManyField(Device)
>
>   def __unicode__(self):
>     return self.name
>
> class ProductForm(forms.ModelForm):
>   class Meta:
>     model = Product
> ---//
>
> ------------
> view.py
> //---
> def create(request):
>     if request.method == 'POST':
>         form = ProductForm(request.POST)
>         if form.is_valid():
>             form.save()
>             return HttpResponseRedirect('/product/detail/'+form.id
> +'/')
>         else:
>             print form.errors
>             errors = form.errors
>             return render_to_response('Product/create.html',{'errors':
> errors,'form':form})
>
>     else:
>         form = ProductForm()
>
>     return render_to_response('Product/create.html',{'form':form})
> ---//
>
> ------------
> create.html
> //---
> <html>
> <head>create</head>
> <body>
> <form action="./" method="post">
> {{ form.errors }}
> <dl>
>   <dt>ID</dt><dd>{{form.id}}</dd>
> </dl>
> <dl>
>   <dt>NAME</dt><dd>{{form.name}}</dd>
> </dl>
> <dl>
>   <dt>Support Browser</dt>
>   <dd>{{form.support_browser}}</dd>
> </dl>
> <dl>
>   <dt>Support Device</dt>
>   <dd>{{form.support_device}}</dd>
> </dl>
>   <input type="submit" value="Create" />
> </form>
> </body>
> </html>
>
> ---//
> ------------
>
> 1.Access to /product/create/ - it works good!
> 2.Complete form and submit - it works good!
> 3.Watch table 'product' - it works good? There's no column
> 'support_browser' and 'support_device'.
> 4.Watch intermidieval table 'product_browser'(autogenerated) - it has
> no rows...
>
> What's wrong?
> Please tell me..

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to