hi, in my urls.py i have imported the MyFormClass from models.py However i am still receiving the error 'NoneType object is not callable'
What else do i need to import? Here is the things i have imported in urls.py #urls.py from django.conf.urls.defaults import * from django.conf import settings from mycompany.press.models import MyForm, MyFormClass from mycompany.press import views import datetime import os from django.forms import ModelForm from django.views.generic import create_update Best Regards On Jul 27, 7:07 pm, Vasil Vangelovski <vvangelov...@gmail.com> wrote: > First, of course you should separate that code, and form classes usually > go in forms.py, models in models.py. > Second, you are getting a 'NoneType object is not callable' beacause of > what you have in urls.py. Look at that carefully and you'll figure it out. > > djangonoob wrote: > > oh by the way, > > i've tried your method and i received the error: > > > 'NoneType' object is not callable > > > May i know how do i solve this issue? > > > Best Regards, > > Eugene > > > On Jul 27, 12:15 pm, Vasil Vangelovski <vvangelov...@gmail.com> wrote: > > >> First you create a ModelForm: > > >> from django.forms import ModelForm > >> from myproject.myapp.models import MyModelClass > > >> class MyFormClass(ModelForm): > >> class Meta: > >> model = MyModelClass > > >> there you have your form_class that you need to pass to the view you want: > > >> ‘django.views.generic.create_update.update_object’, > >> dict(form_class=MyFormClass) > > >> see: > > >>http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-... > > >>> Hi all, > >>> I am wondering how can i use form_class with generic views? > > >>> FOr example, according to the online > >>> doc,http://docs.djangoproject.com/en/dev/ref/generic-views/ > >>> we can use form_class as a required argument for create_object , > >>> update_object, delete_object > > >>> But the online doc stopped short on how to use the form_class. > > >>> Is there anyone woh has a simple example on how to use form_class as a > >>> required argument for generic views? > > >>> Thanks alot! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 -~----------~----~----~----~------~----~------~--~---