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.ocv            form.fields["mppv"].initial 
= db.mppv            form.fields["nvtc"].initial = db.nvtc            
form.fields["mmppc"].initial = db.mmppc            
form.fields["maxov"].initial = db.maxov            
form.fields["maxc"].initial = db.maxc            args = {                
'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 %}    <link rel="stylesheet" 
href="{% static 'calculator/css/home.css' %}"/>    <script 
type="text/javascript" src="{% static 'calculator/js/home.js' 
%}"></script>{% endblock %}{% block main %}    <form action="{% url 
'springcity:home' %}" method="POST" enctype="multipart/form-data">        
{% csrf_token %}        <div class="row center">            <div 
class="input-field col s3 offset-s4">                <select 
id="brandID">                    <option value="">Choose 
Company</option>                    {% for brand in objectlist 
%}                        <option value='{{brand.brand}}'>{{ brand.brand 
}}</option>                    {% endfor %}                
</select>                <!--<label>Choose Company</label>-->            
</div>        </div>        <div class="row center">            <div 
id="modelRow" class="input-field col s3 offset-s4" hidden>                
<select name="mid" id="modelID">                    <option value="">Choose 
Model</option>                </select>                <!--<label>Choose 
Model</label>-->            </div>        </div>        <div class="row 
center">            <div class="col s3 offset-s4">                <div 
class="button-center">                    <button type="submit" class="btn 
waves-effect waves-light" name="Search" 
id="search">Search</button>                </div>            </div>        
</div>        <div class="row center">            <div class="col s3 
offset-s4">                <div class="button-center">                    
<button type="submit" class="btn waves-effect waves-light" name="MInput" 
id="manual_input">Manual Input</button>                </div>            
</div>        </div>    </form>{% 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 <lude...@gmail.com <javascript:> 
> 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 <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> 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
>>  
>> <https://groups.google.com/d/msgid/django-users/8a745765-e3a8-4929-baae-b51ed922ae2d%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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.

Reply via email to