Tuesday, April 24, 2012

Re: Django DateTimePicker only shows up for superusers inside my app

Thanks @Akaariai

after reading what in your link, I fixed the problem by using <script type="text/javascript" src="{% url 'django.views.i18n.javascript_catalog' %}"></script> instead of <script type="text/javascript" src="/admin/jsi18n/"></script>

On Wednesday, April 25, 2012 12:06:25 AM UTC+2, akaariai wrote:
Could you check if the non-admin user can download this script: "/
admin/jsi18n/". It seems downloading that script needs privileges to
access admin site.  That view just provides the javascript catalogs
for "django.conf" and "django.contrib.admin" packages. You can provide
them from different URL, see:
https://docs.djangoproject.com/en/1.4/topics/i18n/translation/#module-django.views.i18n

  - Anssi

On Apr 25, 12:40 am, Ahmad <mygoogli...@gmail.com> wrote:
> I'm using django DateTimePicker widget -- AdminSplitDateTime() -- in event
> creating app, every thing goes fine when the loged in user has superuser
> permissions, but when normal user tries to access the creating form the
> widget don't show up.
>
> I don't know why it acts like this? and how to overcome this behavior?
>
> this is the the scripts included in my page
>
>     <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.min.js"></script>
>     <script type="text/javascript"
> src="/static/admin/js/jquery.init.js"></script>
>     <script type="text/javascript"
> src="/static/admin/js/actions.min.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>
>
> her is my form code
>
>     class Form(ModelForm):
>         """
>
>         """
>
>         class Meta:
>             model = Model
>             exclude = ('creator')
>         def __init__(self, *args, **kwargs):
>             super(Form, self).__init__(*args, **kwargs)
>             self.fields['start'].widget = widgets.AdminSplitDateTime()
>             self.fields['end'].widget = widgets.AdminSplitDateTime()

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate