15. Let us understand what we wrote in edit_contact.html in django project

 edit_contact.html
===================
 
 
<h1>add contact</h1>
<form action="{% url 'contacts-new' %}" method="post">
  {% csrf_token %}

  <ul>
  {{ form.as_ul }}

  </ul>
<input id='save_contact' type="submit" value="save"/>

    
</form>
<a href="{% url 'contacts-list' %}">back to list</a>
 
 
 so let us see what we wrote here 
 
 
 
<h1>add contact</h1>
====================
 
this is heading tag no special if we now the html tags
 
 
 
<form action="{% url 'contacts-new' %}" method="post">
======================================================
 
this is form tag but let see in deep that is 
 
 
action =""
 
we know what is action attribute in form tag where we will write the page which we want to display
 
 
but here we wrote like 
action="{% url 'contacts-new' %}"
 
so ,,,,,, let us think some think else..... ie.,   
 
{%%},,,,, ok what is this ?????? any idea
 
 
 
 
 
 
the answer for this is django template tags
 
 
 
so first  we will see what is template tags.......
 
 
 
 
 so in django we will use variable,tags,filters and decorators....
 

Django default built in:

{} is variables

{variable | variable condition} is filters

{%%} is tags

  
 
 
 
let see with filter and tags in next post......
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

No comments:

Post a Comment