Re: usage of url template tag

2012-03-21 Thread Larry Martell
On Wed, Mar 21, 2012 at 2:06 PM, Daniel Roseman  wrote:
> On Wednesday, 21 March 2012 03:01:23 UTC-7, larry@gmail.com wrote:
>>
>>
>> I'm very new to django. The rest of the URL comes from the index
>> function in views.py. I wasn't sure if it violated the DRY principle
>> to hardcode it.
>
>
> Fine, but you can't reverse a URL that does not exist. If you tried to
> access "/report/faloom/EventLog/" in your browser, you would get a 404
> because you have no URLconf that matches it. So there's no point in
> outputting that URL in your template.

That's not true. My urlpatterns has:

(r'^report/(\w+)/(\w+)/$', motor.core.reports.views.view)

so /report/faloom/EventLog/ get routed to the view function in
motor/core/report/views.py, which renters the page.

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



Re: usage of url template tag

2012-03-21 Thread Daniel Roseman
On Wednesday, 21 March 2012 03:01:23 UTC-7, larry@gmail.com wrote:
>
>
> I'm very new to django. The rest of the URL comes from the index
> function in views.py. I wasn't sure if it violated the DRY principle
> to hardcode it.
>

Fine, but you can't reverse a URL that does not exist. If you tried to 
access "/report/faloom/EventLog/" in your browser, you would get a 404 
because you have no URLconf that matches it. So there's no point in 
outputting that URL in your template.
--
DR.

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



Re: usage of url template tag

2012-03-21 Thread Tim Ney
Have you read the Django book section on advanced urlconfs, there is a very
good discussion on how to put together customs urls. There are also good
examples
as well. The Django book is online all you have to do is google for it.

On Wed, Mar 21, 2012 at 6:01 AM, Larry Martell wrote:

> On Tue, Mar 20, 2012 at 11:04 PM, Daniel Roseman 
> wrote:
> > On Tuesday, 20 March 2012 15:27:27 UTC-7, larry@gmail.com wrote:
> >>
> >> I'm trying to generate a URL that looks something like this:
> >>
> >>
> >>
> /report/faloom/EventLog/?message=EventSearchString_ids=13_1=Tool_2=Time_3=Module_4=Message_preview=Generate+Report
> >>
> >> I have the values for the arguments (message, tool_ids, etc)  available
> to
> >> me.
> >>
> >> My urlconf has:
> >>
> >> (r'^report/$', motor.ui.views.index)
> >>
> >> If I put this in my template:
> >>
> >> {% url motor.ui.views.index %}
> >>
> >> I get:
> >>
> >> /report/
> >>
> >> What do I use as arguments with the url tag to get the URL I want?
> >> I've tried many, many different things, but no matter what, I get a
> >> NoReverseMatch exception.
> >
> >
> > This question makes no sense at all. Your URL is just "/report/". You can
> > add the  GET parameters manually, since they aren't matched in a URLconf,
> > but where is the 'faloom/EventLog' bit supposed to be coming from? There
> is
> > no URL that matches that.
>
> I'm very new to django. The rest of the URL comes from the index
> function in views.py. I wasn't sure if it violated the DRY principle
> to hardcode it.
>
> --
> 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.
>
>

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



Re: usage of url template tag

2012-03-21 Thread Larry Martell
On Tue, Mar 20, 2012 at 11:04 PM, Daniel Roseman  wrote:
> On Tuesday, 20 March 2012 15:27:27 UTC-7, larry@gmail.com wrote:
>>
>> I'm trying to generate a URL that looks something like this:
>>
>>
>> /report/faloom/EventLog/?message=EventSearchString_ids=13_1=Tool_2=Time_3=Module_4=Message_preview=Generate+Report
>>
>> I have the values for the arguments (message, tool_ids, etc)  available to
>> me.
>>
>> My urlconf has:
>>
>> (r'^report/$', motor.ui.views.index)
>>
>> If I put this in my template:
>>
>> {% url motor.ui.views.index %}
>>
>> I get:
>>
>> /report/
>>
>> What do I use as arguments with the url tag to get the URL I want?
>> I've tried many, many different things, but no matter what, I get a
>> NoReverseMatch exception.
>
>
> This question makes no sense at all. Your URL is just "/report/". You can
> add the  GET parameters manually, since they aren't matched in a URLconf,
> but where is the 'faloom/EventLog' bit supposed to be coming from? There is
> no URL that matches that.

I'm very new to django. The rest of the URL comes from the index
function in views.py. I wasn't sure if it violated the DRY principle
to hardcode it.

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



Re: usage of url template tag

2012-03-20 Thread Daniel Roseman
On Tuesday, 20 March 2012 15:27:27 UTC-7, larry@gmail.com wrote:
>
> I'm trying to generate a URL that looks something like this:
>
>
> /report/faloom/EventLog/?message=EventSearchString_ids=13_1=Tool_2=Time_3=Module_4=Message_preview=Generate+Report
>
> I have the values for the arguments (message, tool_ids, etc)  available to 
> me.
>
> My urlconf has:
>
> (r'^report/$', motor.ui.views.index)
>
> If I put this in my template:
>
> {% url motor.ui.views.index %}
>
> I get:
>
> /report/
>
> What do I use as arguments with the url tag to get the URL I want?
> I've tried many, many different things, but no matter what, I get a
> NoReverseMatch exception.
>

This question makes no sense at all. Your URL is just "/report/". You can 
add the  GET parameters manually, since they aren't matched in a URLconf, 
but where is the 'faloom/EventLog' bit supposed to be coming from? There is 
no URL that matches that.
--
DR. 

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



usage of url template tag

2012-03-20 Thread Larry Martell
I'm trying to generate a URL that looks something like this:

/report/faloom/EventLog/?message=EventSearchString_ids=13_1=Tool_2=Time_3=Module_4=Message_preview=Generate+Report

I have the values for the arguments (message, tool_ids, etc)  available to me.

My urlconf has:

(r'^report/$', motor.ui.views.index)

If I put this in my template:

{% url motor.ui.views.index %}

I get:

/report/

What do I use as arguments with the url tag to get the URL I want?
I've tried many, many different things, but no matter what, I get a
NoReverseMatch exception.

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