Friday, February 1, 2013

Re: Problem with FilteredSelectMultiple widget

forms.py
class SampleWidget(forms.Form):
date=forms.CharField(widget=AdminDateWidget,max_length=100)
users = forms.ModelMultipleChoiceField(queryset=User.objects.all(),widget=FilteredSelectMultiple(("Users"), False))


mytemple.html

{% block content %}
<link rel="stylesheet" type="text/css" href="/static/admin/css/base.css" />
<link rel="stylesheet" type="text/css" href="/static/admin/css/forms.css" />
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="/static/admin/css/ie.css" /><![endif]-->

<script type="text/javascript">window.__admin_media_prefix__ = "/static/admin/";</script>


<script type="text/javascript" src="/admin/jsi18n/"></script>
<script type="text/javascript" src="/static/admin/js/core.js"></script>
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
<script type="text/javascript" src="/static/admin/js/actions.js"></script>
<script type="text/javascript" src="/static/admin/js/SelectBox.js"></script>
<script type="text/javascript" src="/static/admin/js/SelectFilter2.js"></script>
<script type="text/javascript" src="/static/admin/js/calendar.js"></script>
<script type="text/javascript" src="/static/admin/js/admin/DateTimeShortcuts.js"></script>

<form action="." method="POST">
{{ form.as_p }}
{{ form.media }}
{% csrf_token %}
<p><input type="submit" value="Submit"></p>
</form>


This working fine if I log in with admin credentials , how to use this with normal user.

Please help me.

Regards,
kvr

On Thursday, January 31, 2013 9:44:11 PM UTC+5:30, Victor Rocha wrote:
Can you post up your code?


On Thursday, January 31, 2013 6:29:08 AM UTC-5, KVR wrote:
Hi,
I am trying to reuse FilteredSelectMultiple widget from django admin widgets.

I've defined my form and media classes, and included form and media contexts in my template also.

But when I load the page, it's just showing multiselect box and below line:

<myapp.admin.forms.media instance at 0xa8589d8c>

What may be the problem and how to get the entire widget.

Regards,
kvr

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

No comments:

Post a Comment