Re: url issues

2018-01-28 Thread sum abiut
Thanks heaps manage to fix it.



On Fri, Jan 26, 2018 at 6:34 PM,  wrote:

> def login(request):
> return render(request,'login.html')
>
> On Friday, January 26, 2018 at 6:33:07 AM UTC+5:30, suabiut wrote:
>>
>> Hi,
>> i am having some issues with my url pattern. i can't seem to figure out
>> the problem. i am running django 1.11.
>>
>> i have an app name userprofile which automatically create user profiles
>> on user creation. I have create a login template to allow users to login in
>> before i can direct them to update their profile but i cannot seem to
>> access the login page.
>>
>> i get this below error
>>
>> [image: Inline image 1]
>>
>> view.py
>> def login(request):
>> return render(request,'login.html')
>>
>>
>>
>> urls.py
>> from django.conf.urls import url
>> from django.contrib import admin
>>
>> from . import views
>>
>>
>> urlpatterns = [
>> url(r'^$',views.login,name='login'),
>>
>> #url('', views.edit_user),
>> url(r'success/$', views.success),
>>
>> ]
>>
>>
>> cheers
>>
>> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/636f672a-7ab9-4853-892b-374e1b16f461%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCf-y5Xor4Ykd7eputBtpXACPo0%3D0ASRqAcB-A9rPiJ3EcF3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: url issues

2018-01-26 Thread rajendran . p
def login(request):
return render(request,'login.html')

On Friday, January 26, 2018 at 6:33:07 AM UTC+5:30, suabiut wrote:
>
> Hi,
> i am having some issues with my url pattern. i can't seem to figure out 
> the problem. i am running django 1.11.
>
> i have an app name userprofile which automatically create user profiles on 
> user creation. I have create a login template to allow users to login in 
> before i can direct them to update their profile but i cannot seem to 
> access the login page.
>
> i get this below error
>
> [image: Inline image 1]
>
> view.py
> def login(request):
> return render(request,'login.html')
>
>
>
> urls.py
> from django.conf.urls import url
> from django.contrib import admin
>
> from . import views
>
>
> urlpatterns = [
> url(r'^$',views.login,name='login'),
>
> #url('', views.edit_user),
> url(r'success/$', views.success),
>
> ]
>
>
> cheers
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/636f672a-7ab9-4853-892b-374e1b16f461%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: url issues

2018-01-25 Thread Omar Abou Mrad
On Fri, Jan 26, 2018 at 3:01 AM, sum abiut  wrote:

> Hi,
> i am having some issues with my url pattern. i can't seem to figure out
> the problem. i am running django 1.11.
>
> <.. snip..>
> urls.py
> from django.conf.urls import url
> from django.contrib import admin
>
> from . import views
>
>
> urlpatterns = [
> url(r'^$',views.login,name='login'),
>
> #url('', views.edit_user),
> url(r'success/$', views.success),
>
> ]
>
>
What's confusing you is the '^$' pattern which you believe should be
activated if you navigate to "http://localhost:8000/; where in fact this
will point to the root url module under your rbv_payslip package.

That root url module has a pattern called "userprofile" which in turn
includes the url file you posted above. If you look closely at the error
you're getting, django is telling you that it could not find the pattern
you tried, but it found "admin" and "userprofile". The latter should
work for you.

Have a look at this part of the tutorial:

https://docs.djangoproject.com/en/1.11/intro/tutorial01/#write-your-first-view

Regards,

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwtXp2MZDC8Hj7styWQNDWPtJWBCv6D4vsoczVqO094CZXu1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django url issues, append slash and case insensitvity

2014-12-26 Thread Collin Anderson
Hi,

waitlist/add_account/ redirecting to waitlistadd_account/ is quite odd to 
me. Could it simply be a bad cached 301? What does curl -i 
http://yourdomain/wailtlist/add_account/ say?

Not sure about the case insensitivity. I've never tried it, but can't think 
of any side effects.

Collin

On Tuesday, December 23, 2014 12:45:33 PM UTC-6, pythonista wrote:
>
> I am having some issues with trailing slashes.
>
> The application is working fine from my local machine whether I add a 
> trailing slash or not.
>
> It is not working as expected on the servers.  The link is being 
> redirected to localhost for some reason.
>
>
> I thought that SLASH_APPEND= True was on by default in the settings.py 
> file.
>
> 1. I can add that to the settings file.
> url(r'^waitlist/',
> 2.  I can addwaitlist/?' ( ?)
> to each url.  
>
> On my machine the url router goes to the correct page, but it now is 
> missing the /
> waitlist/add_account/
>
> now becomes 
>
> waitlistadd_account/(the middle /   is missing, but the code seems to 
> be working.)
>
> Any help would be appreciated.
>
> While I am on a similar subject,
>
> to make the request case insensitive, if I make the above call like this 
> to make it case insensitive, is this the best way, are there any side 
> effects of this approach?
>
> url(r'^(?i)waitlist/?'
>
> Thanks in advance.
>
> We are using nginx, is there any way to code the case insensitivity piece 
> in there?
>
> Thanks
>
> Bob
>

-- 
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+unsubscr...@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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/68644eaf-6817-4ab5-a393-4cea50f0565c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django url issues, append slash and case insensitvity

2014-12-23 Thread pythonista
I am having some issues with trailing slashes.

The application is working fine from my local machine whether I add a 
trailing slash or not.

It is not working as expected on the servers.  The link is being redirected 
to localhost for some reason.


I thought that SLASH_APPEND= True was on by default in the settings.py file.

1. I can add that to the settings file.
url(r'^waitlist/',
2.  I can addwaitlist/?' ( ?)
to each url.  

On my machine the url router goes to the correct page, but it now is 
missing the /
waitlist/add_account/

now becomes 

waitlistadd_account/(the middle /   is missing, but the code seems to 
be working.)

Any help would be appreciated.

While I am on a similar subject,

to make the request case insensitive, if I make the above call like this to 
make it case insensitive, is this the best way, are there any side effects 
of this approach?

url(r'^(?i)waitlist/?'

Thanks in advance.

We are using nginx, is there any way to code the case insensitivity piece 
in there?

Thanks

Bob

-- 
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+unsubscr...@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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/724c4041-24ba-4a04-b427-31fde9c83208%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generic views and url issues

2013-01-24 Thread amy . cerrito
Updating my template code to use namespace:url_name did it!

list url:

List of all ad calls

detail url:



Thanks again for everyone's feedback!  


On Thursday, January 24, 2013 10:07:14 AM UTC-5, Tom Christie wrote:
>
> Hi Amy,
>
> I'd suggest you check the following...
>
> * Your 
> ROOT_URLCONFsetting
>  is correct.
> * If the `urls.py` module you're referring to here is a project URL conf 
> and not the root URL conf, make sure that it is being included by the root 
> URL conf.  (This seems like the most likely cause)
> * If it is being included by the root URL conf, check if it's being 
> included with a `namespace` argument, and if so make sure to prefix the 
> reverse with the appropiate namespace, eg if it's namespaced as 'myapp', 
> then use 'myapp:addcalls'.
>
> You've already made things really simple, the URL conf as you've declared 
> it looks correct, so this...
>
>Reverse for 'adcalls' with arguments '()' and keyword arguments '{}' 
> not found.
>
> Suggests that 'adcalls' simply isn't included part of the URL conf of the 
> application.
>
> Cheers,
>
>   Tom
>
> On Thursday, 24 January 2013 14:01:30 UTC, Amy Cerrito wrote:
>>
>> Thanks for your response!
>>
>> Unfortunately, your suggestion did not eliminate the NoReverseMatch error.
>>
>> NoReverseMatch at /testadcall/
>>
>> Reverse for 'detail' with arguments '()' and keyword arguments 
>> '{'object_id': 1}' not found.
>>
>>
>> I have another example where I request the list view, which does not 
>> expect arguments, to keep it even simpler.
>>
>> urls.py
>>
>> queryset = {'queryset': Adcall.objects.order_by('name')}
>>
>> urlpatterns = patterns('django.views.generic.list_detail',
>> url(r'^$','object_list', queryset, name="adcalls"),
>> url(r'^(?P\d+)/detail/$', 'object_detail', queryset, 
>> name="detail"),
>> )
>>
>>
>> template:
>>
>> EDIT TEMPLATE
>> {% load url from future %}
>> {% csrf_token %}
>> {{ form.as_p }}
>> 
>> 
>>
>> Back to adcall list
>>
>>
>> Error:
>> NoReverseMatch at /testadcall/1/detail/
>>
>> Reverse for 'adcalls' with arguments '()' and keyword arguments '{}' not 
>> found.
>>
>>
>>
>>
>>
>> On Thu, Jan 24, 2013 at 2:53 AM,  wrote:
>>
>>> On 24/01/2013 10:39 AM, amy.c...@cbsinteractive.com wrote:
>>>
 I've been trying to understand how to use generic views.  I've followed 
 some tutorials, and read through Django docs, but I can't get the url 
 function to work in my templates.

 I get the error
 NoReverseMatch at /testadcall/
 Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' 
 not found.

 in my urls.py

 queryset = {'queryset': Adcall.objects.order_by('name'**)}

 urlpatterns = patterns('django.views.**generic.list_detail',
 url(r'^$','object_list', queryset, name="adcalls"),
 url(r'(?P\d+)/**detail/$', 'object_detail', queryset, 
 name="detail"),
 )

 in my template for the list view:

 {% load url from future %}
 {% if object_list %}
 
 {% for adcall in object_list %}
 {{ 
 adcall.name}}
 {% endfor %}
 
 {% endif %}

 I've tried no quotes, single quotes, and double quotes around the url 
 name "detail", with no apparent effect.

 Am I wrong in thinking that this should work?

  
>>> The problem is a mismatch between your urls.py pattern and the 
>>> parameters you give to the url templatetag - note in the error message that 
>>> it mentions both arguments and keyword arguments (with your example having 
>>> a single non-keyword argument). However, in your url pattern for the 
>>> "detail" url, you use a named capture (object_id). In this case, you must 
>>> use a keyword argument to match:
>>>
>>> {% url 'detail' object_id=adcall.id %}
>>>
>>> Regards,
>>> Michael.
>>>
>>
>>
>>
>> -- 
>> Amy Cerrito
>> Engineering Manager, AdOps Technology
>> T 617.284.8697 
>> 55 Davis Sq, Somerville, MA 02143
>>
>>  

-- 
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/-/3kSpsT_r7jAJ.
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: Generic views and url issues

2013-01-24 Thread Tom Christie
Hi Amy,

I'd suggest you check the following...

* Your 
ROOT_URLCONFsetting
 is correct.
* If the `urls.py` module you're referring to here is a project URL conf 
and not the root URL conf, make sure that it is being included by the root 
URL conf.  (This seems like the most likely cause)
* If it is being included by the root URL conf, check if it's being 
included with a `namespace` argument, and if so make sure to prefix the 
reverse with the appropiate namespace, eg if it's namespaced as 'myapp', 
then use 'myapp:addcalls'.

You've already made things really simple, the URL conf as you've declared 
it looks correct, so this...

   Reverse for 'adcalls' with arguments '()' and keyword arguments '{}' not 
found.

Suggests that 'adcalls' simply isn't included part of the URL conf of the 
application.

Cheers,

  Tom

On Thursday, 24 January 2013 14:01:30 UTC, Amy Cerrito wrote:
>
> Thanks for your response!
>
> Unfortunately, your suggestion did not eliminate the NoReverseMatch error.
>
> NoReverseMatch at /testadcall/
>
> Reverse for 'detail' with arguments '()' and keyword arguments '{'object_id': 
> 1}' not found.
>
>
> I have another example where I request the list view, which does not 
> expect arguments, to keep it even simpler.
>
> urls.py
>
> queryset = {'queryset': Adcall.objects.order_by('name')}
>
> urlpatterns = patterns('django.views.generic.list_detail',
> url(r'^$','object_list', queryset, name="adcalls"),
> url(r'^(?P\d+)/detail/$', 'object_detail', queryset, 
> name="detail"),
> )
>
>
> template:
>
> EDIT TEMPLATE
> {% load url from future %}
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
>
> Back to adcall list
>
>
> Error:
> NoReverseMatch at /testadcall/1/detail/
>
> Reverse for 'adcalls' with arguments '()' and keyword arguments '{}' not 
> found.
>
>
>
>
>
> On Thu, Jan 24, 2013 at 2:53 AM,  > wrote:
>
>> On 24/01/2013 10:39 AM, amy.c...@cbsinteractive.com  wrote:
>>
>>> I've been trying to understand how to use generic views.  I've followed 
>>> some tutorials, and read through Django docs, but I can't get the url 
>>> function to work in my templates.
>>>
>>> I get the error
>>> NoReverseMatch at /testadcall/
>>> Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' 
>>> not found.
>>>
>>> in my urls.py
>>>
>>> queryset = {'queryset': Adcall.objects.order_by('name'**)}
>>>
>>> urlpatterns = patterns('django.views.**generic.list_detail',
>>> url(r'^$','object_list', queryset, name="adcalls"),
>>> url(r'(?P\d+)/**detail/$', 'object_detail', queryset, 
>>> name="detail"),
>>> )
>>>
>>> in my template for the list view:
>>>
>>> {% load url from future %}
>>> {% if object_list %}
>>> 
>>> {% for adcall in object_list %}
>>> {{ 
>>> adcall.name}}
>>> {% endfor %}
>>> 
>>> {% endif %}
>>>
>>> I've tried no quotes, single quotes, and double quotes around the url 
>>> name "detail", with no apparent effect.
>>>
>>> Am I wrong in thinking that this should work?
>>>
>>>  
>> The problem is a mismatch between your urls.py pattern and the parameters 
>> you give to the url templatetag - note in the error message that it 
>> mentions both arguments and keyword arguments (with your example having a 
>> single non-keyword argument). However, in your url pattern for the "detail" 
>> url, you use a named capture (object_id). In this case, you must use a 
>> keyword argument to match:
>>
>> {% url 'detail' object_id=adcall.id %}
>>
>> Regards,
>> Michael.
>>
>
>
>
> -- 
> Amy Cerrito
> Engineering Manager, AdOps Technology
> T 617.284.8697 
> 55 Davis Sq, Somerville, MA 02143
>
>  

-- 
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/-/1sLMU3EDLH0J.
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: Generic views and url issues

2013-01-24 Thread Bill Freeman
Have you tried it without the quotes around 'detail' in the url template
tag invocation?

If I'm remembering correctly, the need for the quotes depends on django
version and options.

Bill

On Thu, Jan 24, 2013 at 9:01 AM, Amy Cerrito  wrote:

> Thanks for your response!
>
> Unfortunately, your suggestion did not eliminate the NoReverseMatch error.
>
> NoReverseMatch at /testadcall/
>
> Reverse for 'detail' with arguments '()' and keyword arguments '{'object_id': 
> 1}' not found.
>
>
> I have another example where I request the list view, which does not
> expect arguments, to keep it even simpler.
>
> urls.py
>
> queryset = {'queryset': Adcall.objects.order_by('name')}
>
> urlpatterns = patterns('django.views.generic.list_detail',
> url(r'^$','object_list', queryset, name="adcalls"),
> url(r'^(?P\d+)/detail/$', 'object_detail', queryset,
> name="detail"),
> )
>
>
> template:
>
> EDIT TEMPLATE
> {% load url from future %}
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
>
> Back to adcall list
>
>
> Error:
> NoReverseMatch at /testadcall/1/detail/
>
> Reverse for 'adcalls' with arguments '()' and keyword arguments '{}' not 
> found.
>
>
>
>
>
> On Thu, Jan 24, 2013 at 2:53 AM, wrote:
>
>> On 24/01/2013 10:39 AM, amy.cerr...@cbsinteractive.com wrote:
>>
>>> I've been trying to understand how to use generic views.  I've followed
>>> some tutorials, and read through Django docs, but I can't get the url
>>> function to work in my templates.
>>>
>>> I get the error
>>> NoReverseMatch at /testadcall/
>>> Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}'
>>> not found.
>>>
>>> in my urls.py
>>>
>>> queryset = {'queryset': Adcall.objects.order_by('name'**)}
>>>
>>> urlpatterns = patterns('django.views.**generic.list_detail',
>>> url(r'^$','object_list', queryset, name="adcalls"),
>>> url(r'(?P\d+)/**detail/$', 'object_detail', queryset,
>>> name="detail"),
>>> )
>>>
>>> in my template for the list view:
>>>
>>> {% load url from future %}
>>> {% if object_list %}
>>> 
>>> {% for adcall in object_list %}
>>> {{ 
>>> adcall.name}}
>>> {% endfor %}
>>> 
>>> {% endif %}
>>>
>>> I've tried no quotes, single quotes, and double quotes around the url
>>> name "detail", with no apparent effect.
>>>
>>> Am I wrong in thinking that this should work?
>>>
>>>
>> The problem is a mismatch between your urls.py pattern and the parameters
>> you give to the url templatetag - note in the error message that it
>> mentions both arguments and keyword arguments (with your example having a
>> single non-keyword argument). However, in your url pattern for the "detail"
>> url, you use a named capture (object_id). In this case, you must use a
>> keyword argument to match:
>>
>> {% url 'detail' object_id=adcall.id %}
>>
>> Regards,
>> Michael.
>>
>
>
>
> --
> Amy Cerrito
> Engineering Manager, AdOps Technology
> T 617.284.8697
> 55 Davis Sq, Somerville, MA 02143
>
>  --
> 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: Generic views and url issues

2013-01-24 Thread Amy Cerrito
Thanks for your response!

Unfortunately, your suggestion did not eliminate the NoReverseMatch error.

NoReverseMatch at /testadcall/

Reverse for 'detail' with arguments '()' and keyword arguments
'{'object_id': 1}' not found.


I have another example where I request the list view, which does not expect
arguments, to keep it even simpler.

urls.py

queryset = {'queryset': Adcall.objects.order_by('name')}

urlpatterns = patterns('django.views.generic.list_detail',
url(r'^$','object_list', queryset, name="adcalls"),
url(r'^(?P\d+)/detail/$', 'object_detail', queryset,
name="detail"),
)


template:

EDIT TEMPLATE
{% load url from future %}
{% csrf_token %}
{{ form.as_p }}



Back to adcall list


Error:
NoReverseMatch at /testadcall/1/detail/

Reverse for 'adcalls' with arguments '()' and keyword arguments '{}' not found.





On Thu, Jan 24, 2013 at 2:53 AM, wrote:

> On 24/01/2013 10:39 AM, amy.cerr...@cbsinteractive.com wrote:
>
>> I've been trying to understand how to use generic views.  I've followed
>> some tutorials, and read through Django docs, but I can't get the url
>> function to work in my templates.
>>
>> I get the error
>> NoReverseMatch at /testadcall/
>> Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not
>> found.
>>
>> in my urls.py
>>
>> queryset = {'queryset': Adcall.objects.order_by('name'**)}
>>
>> urlpatterns = patterns('django.views.**generic.list_detail',
>> url(r'^$','object_list', queryset, name="adcalls"),
>> url(r'(?P\d+)/**detail/$', 'object_detail', queryset,
>> name="detail"),
>> )
>>
>> in my template for the list view:
>>
>> {% load url from future %}
>> {% if object_list %}
>> 
>> {% for adcall in object_list %}
>> {{ adcall.name}}
>> {% endfor %}
>> 
>> {% endif %}
>>
>> I've tried no quotes, single quotes, and double quotes around the url
>> name "detail", with no apparent effect.
>>
>> Am I wrong in thinking that this should work?
>>
>>
> The problem is a mismatch between your urls.py pattern and the parameters
> you give to the url templatetag - note in the error message that it
> mentions both arguments and keyword arguments (with your example having a
> single non-keyword argument). However, in your url pattern for the "detail"
> url, you use a named capture (object_id). In this case, you must use a
> keyword argument to match:
>
> {% url 'detail' object_id=adcall.id %}
>
> Regards,
> Michael.
>



-- 
Amy Cerrito
Engineering Manager, AdOps Technology
T 617.284.8697
55 Davis Sq, Somerville, MA 02143

-- 
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: Generic views and url issues

2013-01-23 Thread mgc_django-users

On 24/01/2013 10:39 AM, amy.cerr...@cbsinteractive.com wrote:
I've been trying to understand how to use generic views.  I've 
followed some tutorials, and read through Django docs, but I can't get 
the url function to work in my templates.


I get the error
NoReverseMatch at /testadcall/
Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not found.

in my urls.py

queryset = {'queryset': Adcall.objects.order_by('name')}

urlpatterns = patterns('django.views.generic.list_detail',
url(r'^$','object_list', queryset, name="adcalls"),
url(r'(?P\d+)/detail/$', 'object_detail', queryset, 
name="detail"),

)

in my template for the list view:

{% load url from future %}
{% if object_list %}

{% for adcall in object_list %}
{{ adcall.name 
}}

{% endfor %}

{% endif %}

I've tried no quotes, single quotes, and double quotes around the url 
name "detail", with no apparent effect.


Am I wrong in thinking that this should work?



The problem is a mismatch between your urls.py pattern and the 
parameters you give to the url templatetag - note in the error message 
that it mentions both arguments and keyword arguments (with your example 
having a single non-keyword argument). However, in your url pattern for 
the "detail" url, you use a named capture (object_id). In this case, you 
must use a keyword argument to match:


{% url 'detail' object_id=adcall.id %}

Regards,
Michael.

--
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: Generic views and url issues

2013-01-23 Thread Sanjay Bhangar
(reply inline)

On Thu, Jan 24, 2013 at 5:09 AM,   wrote:
> I've been trying to understand how to use generic views.  I've followed some
> tutorials, and read through Django docs, but I can't get the url function to
> work in my templates.
>
> I get the error
> NoReverseMatch at /testadcall/
>
> Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not
> found.
>
>
> in my urls.py
>
> queryset = {'queryset': Adcall.objects.order_by('name')}
>
> urlpatterns = patterns('django.views.generic.list_detail',
> url(r'^$','object_list', queryset, name="adcalls"),
> url(r'(?P\d+)/detail/$', 'object_detail', queryset,
> name="detail"),
> )
>
> in my template for the list view:
>
> {% load url from future %}
> {% if object_list %}
> 
> {% for adcall in object_list %}
> {{ adcall.name
> }}
> {% endfor %}
> 
> {% endif %}
>

try:
{% url 'detail' object_id=adcall.id %}

since you have object_id defined as a keyword param in the url, you
will need to specify it as a keyword param in the {% url %} tag, I
*think* :)

let know if that works -
best've luck,
Sanjay

> I've tried no quotes, single quotes, and double quotes around the url name
> "detail", with no apparent effect.
>
> Am I wrong in thinking that this should work?
>
> I'm using Django 1.4.3, Python 2.7.3
>
> Thanks so much.
>
> --
> 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/-/M6Qrx89JeBkJ.
> 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: Generic views and url issues

2013-01-23 Thread Sergiy Khohlov
try to  check testaddcall/1/ please
Many thanks,

Serge


+380 636150445
skype: skhohlov


2013/1/24  :
> I've been trying to understand how to use generic views.  I've followed some
> tutorials, and read through Django docs, but I can't get the url function to
> work in my templates.
>
> I get the error
> NoReverseMatch at /testadcall/
>
> Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not
> found.
>
>
> in my urls.py
>
> queryset = {'queryset': Adcall.objects.order_by('name')}
>
> urlpatterns = patterns('django.views.generic.list_detail',
> url(r'^$','object_list', queryset, name="adcalls"),
> url(r'(?P\d+)/detail/$', 'object_detail', queryset,
> name="detail"),
> )
>
> in my template for the list view:
>
> {% load url from future %}
> {% if object_list %}
> 
> {% for adcall in object_list %}
> {{ adcall.name
> }}
> {% endfor %}
> 
> {% endif %}
>
> I've tried no quotes, single quotes, and double quotes around the url name
> "detail", with no apparent effect.
>
> Am I wrong in thinking that this should work?
>
> I'm using Django 1.4.3, Python 2.7.3
>
> Thanks so much.
>
> --
> 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/-/M6Qrx89JeBkJ.
> 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.



Generic views and url issues

2013-01-23 Thread amy . cerrito
I've been trying to understand how to use generic views.  I've followed 
some tutorials, and read through Django docs, but I can't get the url 
function to work in my templates.

I get the error 
NoReverseMatch at /testadcall/

Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not found.


in my urls.py

queryset = {'queryset': Adcall.objects.order_by('name')}

urlpatterns = patterns('django.views.generic.list_detail',
url(r'^$','object_list', queryset, name="adcalls"),
url(r'(?P\d+)/detail/$', 'object_detail', queryset, 
name="detail"),
)

in my template for the list view:

{% load url from future %}
{% if object_list %}

{% for adcall in object_list %}
{{ adcall.name 
}}
{% endfor %}

{% endif %}

I've tried no quotes, single quotes, and double quotes around the url name 
"detail", with no apparent effect.

Am I wrong in thinking that this should work?

I'm using Django 1.4.3, Python 2.7.3

Thanks so much.

-- 
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/-/M6Qrx89JeBkJ.
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: Media and Admin Media URL Issues

2006-07-27 Thread Nebojša Đorđević

On 26 Jul 2006, at 09:37, Tyson Tate wrote:


In my project's root, I have my regular media in "media/" and the
admin media in "media/admin/". For some reason, I can't access
anything under "media/". My server just gives me a 404. Everything
under "media/" has 777 permissions.




.htaccess:
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/failed_auth.html$
RewriteRule ^.*$ - [L]

RewriteRule ^(media/.*)$ - [L]
RewriteCond %{REQUEST_URI} !(django.fcgi)
RewriteRule ^(.*)$ django.fcgi/$1 [L]



settings.py:
MEDIA_ROOT = '/home/ohgoditb/django_projects/fallingbullets/media/'
MEDIA_URL = 'http://fallingbullets.com/media/'
ADMIN_MEDIA_PREFIX = 'http://www.fallingbullets.com/media/admin/'


Is the MEDIA_ROOT under web server root? If not you will have to add  
something like this in apache conf:


Alias /media/ /home/ohgoditb/django_projects/fallingbullets/media/



--
Nebojša Đorđević - nesh
Studio Quattro - Niš - Serbia
http://studioquattro.biz/
http://djnesh.blogspot.com/  |  http://djnesh-django.blogspot.com/ |   
http://trac.studioquattro.biz/djangoutils/

Registered Linux User 282159 [http://counter.li.org]




PGP.sig
Description: This is a digitally signed message part


Re: Media and Admin Media URL Issues

2006-07-26 Thread SmileyChris

http://www.djangoproject.com/documentation/static_files/ says:
Using this method is inefficient and insecure. Do not use this in a
production setting. Use this only for development.

I'd guess that you just needed to symlink the media and admin media
directories to your site root.


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



Re: Media and Admin Media URL Issues

2006-07-26 Thread Tyson Tate

Adding that to urls.py and removing the media/ rewrite rule from  
my .htaccess file seemed to do the trick. Thanks!

-Tyson


On Jul 26, 2006, at 1:22 AM, Aidas Bendoraitis wrote:

> Do you have something like:
> (r'^media/(?P.*)$', 'django.views.static.serve',
> {'document_root':
> '/home/ohgoditb/django_projects/fallingbullets/media/'}),
> in your urls.py?
>
> Regards,
> Aidas Bendoraitis [aka Archatas]


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



Re: Media and Admin Media URL Issues

2006-07-26 Thread Aidas Bendoraitis

Do you have something like:
(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root':
'/home/ohgoditb/django_projects/fallingbullets/media/'}),
in your urls.py?

Regards,
Aidas Bendoraitis [aka Archatas]

On 7/26/06, Tyson Tate <[EMAIL PROTECTED]> wrote:
>
> I'm having some rather befuddling problems with getting my media URLs
> working for .
>
> In my project's root, I have my regular media in "media/" and the
> admin media in "media/admin/". For some reason, I can't access
> anything under "media/". My server just gives me a 404. Everything
> under "media/" has 777 permissions.
>
> I'm running the latest Django SVN under FastCGI on Bluehost with the
> following configurations:
>
> .htaccess:
> http://paste.e-scribe.com/880/
>
> django.fcgi:
> http://paste.e-scribe.com/881/
>
> settings.py:
> MEDIA_ROOT = '/home/ohgoditb/django_projects/fallingbullets/media/'
> MEDIA_URL = 'http://fallingbullets.com/media/'
> ADMIN_MEDIA_PREFIX = 'http://www.fallingbullets.com/media/admin/'
>
> If anyone has any ideas, I'd love to hear them.
>
> Thanks in advance for any help,
> Tyson
>
> >
>

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



Media and Admin Media URL Issues

2006-07-26 Thread Tyson Tate

I'm having some rather befuddling problems with getting my media URLs  
working for .

In my project's root, I have my regular media in "media/" and the  
admin media in "media/admin/". For some reason, I can't access  
anything under "media/". My server just gives me a 404. Everything  
under "media/" has 777 permissions.

I'm running the latest Django SVN under FastCGI on Bluehost with the  
following configurations:

.htaccess:
http://paste.e-scribe.com/880/

django.fcgi:
http://paste.e-scribe.com/881/

settings.py:
MEDIA_ROOT = '/home/ohgoditb/django_projects/fallingbullets/media/'
MEDIA_URL = 'http://fallingbullets.com/media/'
ADMIN_MEDIA_PREFIX = 'http://www.fallingbullets.com/media/admin/'

If anyone has any ideas, I'd love to hear them.

Thanks in advance for any help,
Tyson

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