hi, I use a form class in Generic views  'list_detail.object_list' para
'extra_context '


form

> class DevSrcForm(forms.Form):
>     f_eqno = forms.CharField(label='编号')
>     f_eqclass =
forms.ChoiceField(choices=(),widget=forms.Select(attrs={}),label='分类')
>     f_ipaddress = forms.CharField(required=False,label='IP地址')
>     f_sdate = forms.DateField(label='开始日期')
>     f_edate = forms.DateField(label='结束日期')
>     f_model = forms.CharField(label='型号')
>     f_empid =
forms.ChoiceField(choices=(),widget=forms.Select(attrs={}),label='用户')
>     def __init__(self, *args, **kwargs):
>         super(DevForm, self).__init__(*args, **kwargs)
>         self.fields['f_eqclass'].choices = [(i.fid,i.fclass) for i in
OaEqclass.objects.all()]
>         self.fields['f_empid'].choices = [(i.fid,i.name) for i in
ViewEmpl.objects.all().order_by('name')]
>
>
view
>
>    if request.method == "GET":
>         # DevSrcForm是一个form类
>         SrcForm = DevSrcForm()
>
>         return list_detail.object_list(
>              request,
>              queryset =  ViewEqinfo.objects.all(),
>              template_name = 'device/device.html',
>              paginate_by = 20,
>              extra_context = {'srcform': SrcForm}
>         )
>
error info
>
> super(type, obj): obj must be an instance or subtype of type
remove 'extra_context' , page normal display.

'extra_context' not use form class?

-- 
××××××××××××××××××××××××
西安――深圳――上海
http://szxatjp.blog.163.com/
××××××××××××××××××××××××

-- 
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.

Reply via email to