I have taken a, perhaps, unorthodox tact for my admin views. I use
myproject/urls.py to grab the url and redirect to
myapp.admin_views.samurai_detail

urls.py catches url patterns such as:
r'^admin/myapp/samurai/(?P<samurai_id>.*)/add_item/$'
r'^admin/myapp/samurai/(?P<samurai_id>.*)/$

I am keeping all of my admin_views in admin_views.py although I keep my
ModelAdmin classes in admin.py, so I sort of have two admin files.

The HttpResponseRedirect is supposed to go from
admin_views.add_item_to_samurai (after a successful request.POST) to
admin_views.samurai_detail

How would I craft the reverse() for that?

Note that if I do just do reverse('add_item_to_samurai') or however I try to
pass in the samurai_id keyword, I get the same error (noted in top post).

-TIm

On Thu, Feb 25, 2010 at 4:14 PM, Karen Tracey <[email protected]> wrote:

> On Thu, Feb 25, 2010 at 4:25 PM, bruno desthuilliers <
> [email protected]> wrote:
>
>> On 25 fév, 20:49, Timothy Kinney <[email protected]> wrote:
>> > I think I'll just
>> > stick with urls.
>>
>> Mmmm... Fine for you if it works, but as far as I'm concerned I don't
>> like it. I do use HttpResponseRedirect, but I pass in the result of a
>> call to reverse(), always using named urls. OTHO, I don't know if
>> admin urls are named.
>>
>>
> They are, and reversable, as of 1.1:
> http://docs.djangoproject.com/en/1.1/ref/contrib/admin/#admin-reverse-urls
>
> I'm a little unclear on what's being done here to override admin views with
> views provided by the app, though, so I'm not sure that's relevant for the
> original question. Looking back at the original question I'd expect a view
> named samurai_detail to take an argument that specifies what samurai to show
> details for, yet the call to reverse specified no arguments. That could be
> the cause of the revere() failure.  Without specifics of the actual url
> patterns being used, though, it's hard to ay for ure.
>
> Karen, using laptop with a barely functioning s key and tired of fixing the
> tupid typo that reult. Sorry about that.
>
> --
> 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]<django-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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

Reply via email to