Re: Render works but url does not change

2018-11-16 Thread Jason
You're rendering templates and returning the response, but if you want the 
URL to change, you need to do a redirect.

Right now, you're telling django for button submits, render the portal 
template and return the html.  There's nothing in it about redirecting to 
another URL

-- 
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/c2a26a14-5ec4-4905-b8cc-3222948d3f5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Render works but url does not change

2018-11-15 Thread Derrick Lu
This is my url.py








*app_name = 'springcity'urlpatterns = [url(r'^$', views.index, 
name='index'),url(r'^home/$', views.home, name='home'),
url(r'^portal/$', views.portal, name='portal'),
url(r'^ajax/cutlist/$', views.cutList, name='cutlist'),]*

This is my views.py

































*def home(request):if request.method == "POST":if 'Search' in 
request.POST:modelIn = request.POST['mid']db = 
get_object_or_404(PDetails, model=modelIn)form = 
calcForm()form.fields["stc"].initial = db.stc
form.fields["ocv"].initial = db.ocvform.fields["mppv"].initial 
= db.mppvform.fields["nvtc"].initial = db.nvtc
form.fields["mmppc"].initial = db.mmppc
form.fields["maxov"].initial = db.maxov
form.fields["maxc"].initial = db.maxcargs = {
'calcForm': form,}return render(request, 
'calculator/portal.html',args)else:if 'MInput' in 
request.POST:form = calcForm()args = 
{'calcForm': form,}
request.method = "GET"return render(request, 
'calculator/portal.html',args)   else:if request.method == 
"GET":objectlist = 
Brand.objects.all().order_by('brand')args = {
'objectlist': objectlist,}return 
render(request, 'calculator/home.html',args)*

Then this is my html that I start off with.





















































*{% extends 'calculator/index.html' %}{% block title %} Home {% endblock 
%}{% block link %}{% load staticfiles %}{% endblock %}{% block main %}
{% csrf_token %}Choose 
Company{% for brand in objectlist 
%}{{ brand.brand 
}}{% endfor %}


Choose 
ModelSearch

Manual Input
{% endblock %}*

On Friday, 16 November 2018 13:52:14 UTC+8, Joel wrote:
>
> Post details.. The url, your urls.py etc
>
> On Fri, 16 Nov, 2018, 8:05 AM Derrick Lu  
> wrote:
>
>> HI,
>> I am having trouble with url when rendering to a new page via a button.
>> The new page renders but the url does not reflect the new page.
>> Has anyone had that problem before?
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/8a745765-e3a8-4929-baae-b51ed922ae2d%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/81642d5b-a48a-45b8-b4ac-81d686b11f56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Render works but url does not change

2018-11-15 Thread Joel
Post details.. The url, your urls.py etc

On Fri, 16 Nov, 2018, 8:05 AM Derrick Lu  HI,
> I am having trouble with url when rendering to a new page via a button.
> The new page renders but the url does not reflect the new page.
> Has anyone had that problem before?
>
> --
> 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/8a745765-e3a8-4929-baae-b51ed922ae2d%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/CAA%3Diw_8s46%3DSmDWA%3D4jGSuDsaSS-jGFL8OvdqjHpPTPZq%3DKfww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.