On Thu, Jun 23, 2011 at 3:52 PM, Satyajit Sarangi
<writetosatya...@gmail.com> wrote:
> {% extends "base.html" %}
>
> {% load i18n %}
> Hello User {{user}}
> {% block content %}
>    {% if form.errors %}
>    <p class="errorlist">{% trans "Sorry there are corrections needed
> in your form below:" %} {{ form.non_field_errors }}</p>
>    {% endif %}
>    {% if form.is_multipart %}
>    <form enctype="multipart/form-data" method="post" action=".">
>    <html>Hello User {{user}}</html>
>    {% else %}
>    <form method="post" action=".">
>   {% endif %}
>   {{ form.as_p }}
>   <input type="submit" value="Upload Zipped Shapefile" />
>   </form>
> {% endblock %}
>
> This is a template of mine . It is not displaying Hello User . What
> can be the error ?

Template inheritance replaces the blocks in the parent with the blocks
in the child template with the same name. Where you output 'Hello
User' is outside of any named blocks, so is ignored. Read the docs:

https://docs.djangoproject.com/en/1.3/topics/templates/#template-inheritance

>
>
> The other doubt is this .
>
>
> <li><a href="{% url Osmmaps  %}">Create a map with OsmMap as
> baselayer</a></li> This is a link on one of my templates .
> Osmmaps.html is a template that displays a form comprising of a OSM
> layers .
>
> Both are in different apps .
>
> Thus when I try to link it , this is the error I get
> Reverse for 'Osmmaps' with arguments '()' and keyword arguments '{}'
> not found.
>

The {% url %} tag takes either a view reference (eg
'myapp.views.something') or a view name, as configured when the URL
for that view is configured in your urls.py. It does not take a HTML
template name with '.html' stripped off the end. Again, docs:

https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#url
https://docs.djangoproject.com/en/1.3/topics/http/urls/
https://docs.djangoproject.com/en/1.3/topics/http/urls/#naming-url-patterns

Cheers

Tom

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

Reply via email to