permissions in template

2007-03-12 Thread masuran

Hello everyone,

I've created a custom permission on one of my models and I've given a
user the custom permission.

When I go into the shell (manage.py shell), I can confirm that the
user has the custom permission. But when I use the perms object in one
of my templates, it simple doesn't work.

{% if perms.custom_perm %}
 do something
{% endif %}

According to the documentation, the perms object is included in the
template language. So I assume I don't have to create the object and
pass it to my template?
I've even tried the fix posted here http://code.djangoproject.com/ticket/2418
but to no avail. I still can't use the perms object in my template.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: permissions in template

2007-03-13 Thread masuran

I'm going to download the development version and try that one out,
might do the trick :)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



SelectMultiple widget

2007-04-10 Thread masuran

Hello everyone,

The admin interface has the most wonderful SelectMultiple widget that
you can have with a ManyToMany Field. You know, the one with the two
listboxes where you can transfer an item from the left to the right.

Does anyone know how you can use this widget in your own forms? I can
only manage to get one blank listbox.

I use the following line to specify the widget together with the
newforms implementation.

WerkgroepToevoegenForm.base_fields['leden'].widget =
widgets.SelectMultiple()


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SelectMultiple widget

2007-04-10 Thread masuran

Hey Enrico,

I already tried that, I can't see anything special about the code in
the admin page.

On 10 apr, 14:21, "Enrico" <[EMAIL PROTECTED]> wrote:
> Hi!
>
> The widget is almost the same as your "blank listbox" but with a
> little Javascript.
>
> Take a look at the admin page source, it may be easy to reuse the
> code.
>
> Best regards,
> Enrico


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SelectMultiple widget

2007-04-11 Thread masuran

Hello Enrico,

First of all thank you for your help :)
But unfortunately that didn't solve my problem.

Next I tried to copy the entire source of an admin generated form that
had the two list boxes and modify it. But even without modifying it I
didn't get the two listboxes. Very very very strange. Two pages with
the exact same source and only the one generated by the admin part has
the two listboxes.

I'm getting pretty confused :)

On 10 apr, 21:11, "Enrico" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> There is a 'YOUR_ADMIN_MEDIA/js/SelectFilter2.js' file, I think this
> is the file that does the "magic".
>
> Maybe you can use it as a base for applying the widget on your site.
>
> Best regards,
> Enrico


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SelectMultiple widget

2007-04-12 Thread masuran

Finally, problem solved :)

These are the javascript functions included in the admin page that
works:







The problem was the fact that the jsi18n script is included by a
relative path. If your URL path is just one directory longer or
shorter than the admin URL path, the i18n script can't be found
anymore.

The solution is this:



Use an absolute path. Depending on your setup offcourse.

Thanks Enrico and Rob for your help :)
On 12 apr, 01:22, "Enrico" <[EMAIL PROTECTED]> wrote:
> Hi Masuran,
>
> You're welcome. :)
>
> That's weird!
> Did you save the entire page source *with* embedded files (.css, .js,
> images)?
>
> The page source itself is the same, what makes the "magic" is the
> 'SelectFilter2.js' file, that manipulates the source when the page
> loads, transforming SelectMultiple fields into that cool widget.
>
> I agree with Rob, if you didn't touch the page source, you may be
> missing some JS files.
> If you read the comments inside the 'SelectFilter2.js' file, you'll
> see that it requires some other files.
>
> Good luck,
> Enrico


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---