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.