def main(request):
context=Context()
this_is_the_template_object = loader.get_template("main/
start.html")
this_is_the_template_rendered=this_is_the_template_object.render(context)
return HttpResponse(this_is_the_template_rendered)
What you are feeding HttpResponse is the
Hi all!
I've encountered a strange bug today.
I want to return an HTTP response with this code:
def main(request):
t = loader.get_template("main/start.html")
return HttpResponse(t)
However, the only result I get is
<'>
and the rest of the html file has gone. The same error
Hi all!
I've encountered a strange bug today.
I want to return an HTTP response with this code:
def main(request):
t = loader.get_template("main/start.html")
return HttpResponse(t)
However, the only result I get is
<'>
and the rest of the html file has gone. The same error
Hi all!
I've encountered a strange bug today.
I want to return an HTTP response with this code:
def main(request):
t = loader.get_template("main/start.html")
return HttpResponse(t)
However, the only result I get is
<'>
and the rest of the html file has gone. The same error
On Jul 27, 9:05 am, Rodney Topor <r.to...@gmail.com> wrote:
> What is the recommended best practice for locating templates in a
> project directory?
Depends...
> In particular, which of the following two
> structures is considered better?
>
> 1. project/templates/{app1,
On 27/07/2011 5:05pm, Rodney Topor wrote:
What is the recommended best practice for locating templates in a
project directory? In particular, which of the following two
structures is considered better?
1. project/templates/{app1,app2,...}
This is better if you have a separate team editing
What is the recommended best practice for locating templates in a
project directory? In particular, which of the following two
structures is considered better?
1. project/templates/{app1,app2,...}
2. project/{app1/templates, app2/templates,...}
If some template is independent
btw, I was correct, it was the development settings causing the problem
On Wed, Jul 13, 2011 at 1:43 PM, Joshua Russo wrote:
> Correct
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on
On Fri, Jul 15, 2011 at 6:41 AM, samuele.mattiuzzo wrote:
> Nope, what i wanted to achieve is just to have django forms spawn my
> custom html instead of the default one.
note that you can simply not use the form rendering, simply use your
HTML (in a template, or even on a
I figured out i have to override the default form classes of django
i have to create a
CustomCheckboxSelectMultiple(CheckboxSelectMultiple) class and
override the "render" method, making it generate the html i want for
my particular cases
--
You received this message because you are subscribed
f course you might want to edit it a little bit for it to comply
> with the other templates.
>
> If you want to work with the data from the forms, you'll have to pass the
> forms data (whatever is inputet or selected) to a view (per urls.py) and t
I am also not sure, what exactly you are looking for, but what about this:
https://docs.djangoproject.com/en/1.3/topics/forms/#customizing-the-form-template
so you will have complete control of your html code???
--
You received this message because you are subscribed to the Google Groups
I'm not sure if i understood your problem a 100 percent so i'll just write what
i think you want ^^
>From what i understand i think you can use the code that has already been
>written. Of course you might want to edit it a little bit for it to comply
>with the other templates.
If
basic problem: i need to create real customized templates for my
django forms. That's it. I'm used to style the forms based on django's
output. This time is different, the html/css template is already done
(months before i was hired) and i cannot modify it, so i need django
to output exactly
Correct
--
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/-/K5yKllF_gPcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe
*light bulb* I forgot about my development vs production settings. I was
only changing the TEMPLATE_DIRS in the main settings.py that represents my
production settings. I'm not in a place where I can test this but I'm almost
certain that's what the problem is.
--
You received this message
To be clear, when you say registration/login, you mean
templates/registration/login, correct?
Your 'registration' directory should be in a 'templates' dir.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
Cool, thanks for the confirmation.
I do have my template directories explicitly listed in TEMPLATE_DIRS. I even
made sure that my app's templates came before the admin templates, but for
some reason it's not picking up my /registration/logged_out.html and the
others that show up
On 07/13/2011 12:46 PM, Joshua Russo wrote:
That's fine, but I was under the impression that the templates could
be overridden just by creating the proper path in my template
directories. Is that not true?
It's true. Check the order of your TEMPLATE_DIRS in settings.py. If you
don't have
That's fine, but I was under the impression that the templates could be
overridden just by creating the proper path in my template directories. Is
that not true?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this
gt; *An:* django-users@googlegroups.com
> *Betreff:* Trouble overriding registration templates
>
> ** **
>
> I want to use my own logout template but it doesn't want to pick it up. The
> login template worked just fine, but for anything that's already in the
> admin's templ
Am I wrong about how templates work?
--
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/-/FVBKI9qS2PQJ.
To post to this group, send email to dj
Sorry, auto correct strikes again. I was trying to reply quickly from my
phone. I meant auth, not author views.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
I do have a views that are basically just proxies for the author views, but I
was under the impression that if I just wanted to replace the registration
templates then all I needed was a registration directory in my templates
directory with the right file names. From there it should just take
@googlegroups.com
Betreff: Trouble overriding registration templates
I want to use my own logout template but it doesn't want to pick it up.
The login template worked just fine, but for anything that's already in
the admin's template/registration folder, it only wants to use those. I
tried putting my
I want to use my own logout template but it doesn't want to pick it up. The
login template worked just fine, but for anything that's already in the
admin's template/registration folder, it only wants to use those. I tried
putting my templates folder before the admin templates folder in the list
Hi,
I'm deveolping some reusable apps with the aim of generating apache
config files.
The schema is: one 'base' app called apache and an arbitrary number of
apps that act as OPTIONAL extensions.
These extension apps fit with base app on django-admin as inlines
forms, and the template is rendered
t 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
{{user}}
{% else %}
{% endif %}
{{ form.as_p }}
{% endblock %}
This is a template of mine . It is not displaying Hello User . What
can be the error ?
The other doubt is this .
Create a map with OsmMap as
baselayer This is a link on one of my templates .
Osmmaps.html is a te
Hi,
I am using inline fromsets in my own custom forms and would like to
reuse the same functionality that is provided django admin's
inlines.js, particularly the add row button functionality, in order to
add rows to my own inline formsets, similarly as is done in django's
admin. What is the
Figured it out. Added this to my Model:
@property
def spacer(self):
return (25-len(str(self.team.name)))*' '
then in my template just added {{ team.spacer }}
On Jun 17, 7:17 pm, Chris McComas wrote:
> I have this as my template code:
>
>
I have this as my template code:
http://dpaste.com/555651/
This is the HTML it is outputting, which makes sense. What I'm trying
to do is make it so the closing tag is right after the team name
and the whitespace from the ljust after it.
http://dpaste.com/555649/
--
You received this message
f following modern practice and doing feature
detection:
http://api.jquery.com/jQuery.support/
If you're looking to support mobile devices:
http://stackoverflow.com/questions/164427/change-django-templates-based-on-user-agent
http://www.chicagopython.com/blog/mobile-web-development-django/
--
You re
Hi Everyone!
How can I create Django tablet site program?
How can decide Django redirect the web site or mobile site or tablet
site?
Does there has separately browser detection?
Thanks
Nge
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
ok ... still struggling.
While in Public_site.views I can call functions from within the
Extranet_site.views ... but I can't even do a:
return
HttpResponseRedirect(reverse('Extranet_site.application_name.views.function_name',
args=(999,)))
Within my Public_site.settings I have installed
@Shawn
Cheers. I'm such a c*ck. I am so used to using named URL patterns that
I just assumed that that was how you did it. So yes, I've had a look
at the documentation, although still struggling to get it to find the
reverse, even when using the full path.
--
You received this message because
Does this help?
http://docs.djangoproject.com/en/1.3/topics/http/urls/#topics-http-reversing-url-namespaces
I found it here (where a usage example is given):
http://docs.djangoproject.com/en/1.3/ref/templates/builtins/#url
--
You received this message because you are subscribed to the Google
.
A scenario would be that :
1. Someone creates a request on the Extranet_site or via the
Public_site
2. This then gets processed using the code within Extranet_site,
regardless of where the request came from.
3. An email gets sent to the relevant field manager to deal with it.
The email templates
essors that will add
> dynamic data you want to display into the context. Then you can use it
> even in your base template. However, you'll have to make sure each
> view uses a RequestContext when rendering templates in order for the
> context processors to be applied.
>
> As for the s
template tags as suggested by others. The
alternative is to create custom context processors that will add
dynamic data you want to display into the context. Then you can use it
even in your base template. However, you'll have to make sure each
view uses a RequestContext when rendering templat
I suggest reading about inclusion tags:
http://docs.djangoproject.com/en/1.3/howto/custom-template-tags/
worked for me
Gabe
On 13 Maj, 07:51, Mateusz Marzantowicz
wrote:
> On Fri, May 13, 2011 at 5:15 AM, robinne wrote:
>
> How can I
On Fri, May 13, 2011 at 5:15 AM, robinne wrote:
How can I render dynamic content in a base template if I only call a
> view on my child template?
>
> What I am trying to do is setup a base template that will include
> "Profile" information for the user who is logged
On Friday, May 13, 2011 1:01:26 AM UTC+1, Stodge wrote:
>
> Is there any interest in changing the inclusion template functionality
> to let the function return the template name in the dictionary to the
> inclusion_tag decorator? This would let the developer override the
> template filename:
On Friday, May 13, 2011 4:15:59 AM UTC+1, robinne wrote:
>
> How can I render dynamic content in a base template if I only call a
> view on my child template?
>
> What I am trying to do is setup a base template that will include
> "Profile" information for the user who is logged in, for
How can I render dynamic content in a base template if I only call a
view on my child template?
What I am trying to do is setup a base template that will include
"Profile" information for the user who is logged in, for example:
"Welcome John", instead of "login here", on every page. But if I call
Is there any interest in changing the inclusion template functionality
to let the function return the template name in the dictionary to the
inclusion_tag decorator? This would let the developer override the
template filename:
{{{
@register.inclusion_tag('block/render_region.html')
def
> Or is there other better solution?
I think you should handle this in the view, like checking there if the
user has sufficient privileges for seeing the message.
Kenny
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
Hi,
django.contrib.messages is very handy and useful app. When I use it in
template I'd like to print in one place in template only messages with
certain level. That's not possible as I can understand it. You can
print all of them (as described in documentation):
{% if messages %}
{% for
On Apr 23, 6:43 pm, Shawn Milochik wrote:
> It occurs to me now that I could just use a placeholder, and replace
> that in JavaScript:
> Update Payment
>
> Then use the JavaScript to replace the string 'payment_id' (or a regex
> on its location in the URL) when the user
On Sat, Apr 23, 2011 at 3:31 AM, Ryan Osborn wrote:
> You could always make the payment_id group optional using a ?:
>
> update_payment/(?P\w+)?
Ryan,
Thanks. I considered that first, but rejected it because I want the
extra field to be required. If it's missing then
If it's quite a big project with lots of ajax, I'd say it's worth a try to
serve your urls to the client in some reasonable way and then write an
equivalent of reverse() in javascript.
On 23 kwi 2011, at 09:31, Ryan Osborn wrote:
> You could always make the
You could always make the payment_id group optional using a ?:
update_payment/(?P\w+)?
that way this will match either:
update_payment/
or
update_payment/123
Hope that helps,
Ryan
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
I'm working on an app which makes extensive use of AJAX. I'm also
using named URLs so I don't have to hard-code URLs into my templates.
The problem is that if a URL pattern requires extra info after the
path, my templates don't render, because the extra parameters aren't
known until the user
thanks, i think you are right, but now i cant check it, i'll do it
later!
thanks!
On 17 abr, 23:00, Daniel Roseman wrote:
> On Sunday, 17 April 2011 21:41:15 UTC+1, Antonio Sánchez wrote:
>
> > hi, im working with a modelform, and overrided clen methos for making
> > some
On Sunday, 17 April 2011 21:41:15 UTC+1, Antonio Sánchez wrote:
>
> hi, im working with a modelform, and overrided clen methos for making
> some custom checks, raising a forms.ValidationError when i need, im
> sure this error is raised, but i dont know why in the template errors
> are not
hi, im working with a modelform, and overrided clen methos for making
some custom checks, raising a forms.ValidationError when i need, im
sure this error is raised, but i dont know why in the template errors
are not showed (instead of form is showed again cause it's not
valid!), here is some of
custom user.has_perm does not get called with
the object.
my question is how do i use object level permissions in templates? any
resources, blog posts, etc would be well appreciated.
i want to make it clear that i am not using the default app level,
built in permissions, so telling me to go
hey
use:
str.isdigit()
http://www.tutorialspoint.com/python/string_isdigit.htm
what is idDigit() ? is that a call to a method somewhere else.
and arent you trying to validate numberofapples = request.POST['numberofapples']
not playerid?
Personally if this is form data you are trying to
Hi django experts,
just want to know your opinion on how to validate the user input
(example: the user input field should be integer, but the user
accidentally inputs any character), here is my code:
FYI; the numberofapples field is IntegerField
here is my sample code:
def
stored in a "compiled" form. Django's cache framework
> doesn't seem to be what I'm searching for, since if caches the entire
> rendered template along with its dynamic context, thus shadows all
> changes I make on printed variables unless I manually invalidate the
> cache.
&g
if caches the entire
rendered template along with its dynamic context, thus shadows all
changes I make on printed variables unless I manually invalidate the
cache.
Did I miss the entire point of using Django templates? Since my
templates won't change once in production, parsing them on each
request wasn
> and then make these accessible in some random template using somthing like
> the following:
>
> Can anyone suggest a good way of doing this?
>
1) write your own context_processors
http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors
2)
I have a bunch of regular site paths that I'd like to be able to refer to
both in my Python code and in my templates, e.g.
settings.py:
site_root = "/portal"
contact_url = site_root + "/contact"
sitemap_url = site_root + "/sitemap"
login_url = site_root + "/ac
1. Create a Django form.
2. Add a ChoiceField to the form.
3. Populate the ChoiceField's 'choices' properly with an iterable
(tuple or list) full of iterables containing the key and value you
like.
4. Put the form into your template somewhere within your HTML form.
Shawn
P.S.
I recommend
hi django experts!
May I know how to create templates that has django widgets in it?
please refer to my should-be template output below:
Name:
here is the sample model:
class Name(models.Model):
name_id = models.AutoField(primary_key=True
On Friday, March 18, 2011 7:29:09 AM UTC, django beginner wrote:
>
> Hi all,
>
> How do I use widgets on the field of a template(not forms)? Let's say
> I have a field called Member, and this field should be in select form
> that has choices from members table (field: member_name)?
>
> tried
On Friday, March 18, 2011 2:08:02 AM UTC, django beginner wrote:
>
> Hi Django users,
>
> I am having some dilemma over converting simple admin page *Template*(without
> having to use the built in django-admin functionality) by using
> forms, and not templates, I have th
Hi all,
How do I use widgets on the field of a template(not forms)? Let's say
I have a field called Member, and this field should be in select form
that has choices from members table (field: member_name)?
tried using select option on html, but it ain't seem to work. any
inputs? Thanks.
--
You
Hi Django users,
I am having some dilemma over converting simple admin page Template
(without having to use the built in django-admin functionality) by
using forms, and not templates, I have the following sample Admin page
that allows users to add, edit and delete record per row to Forms:
(Edit
Hi Django users,
I am having some dilemma over converting simple admin page
*Template*(without having to use the built in django-admin
functionality) by using
forms, and not templates, I have the following sample Admin page that allows
users to add, edit and delete record per row* to Forms
Thanks, will try that once I get to my computer : )
--
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
Hi,
you can try {{ list.0.title }}
Regards,
--
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
I have a list of python objects with attributes, which is supplied to the
django templating engine. I access the first element in the list, to get a
particular attribute 'title', from it. Here is the code:
{{ list|first.title }}
The error given is:
TemplateSyntaxError: Could not parse the
Hi folks,
I using google app engine, in 0.96 I have no problem to include a
template as following
{% include "../header.html" %}
However, in 1.2 the code above not functioning??
Any idea?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
odel_create.html', {'form' : form})
>
> >
>
> The context processor is not invoked, because you're not using a
> RequestContext. So the messages variable is not added to your context. The
> last line should be:
>
> return render_to_response('mymodel_create.html', {'
C:\library
>
> 02/19/2011 07:29 PM mainapp
> 02/19/2011 11:26 AM 557 manage.py
> 02/19/2011 08:16 PM media
> 02/19/2011 08:19 PM 3,537 settings.py
> 02/19/2011 08:19 PM 2,215 settings.pyc
> 02/19/2011 07:58 PM t
dia
02/19/2011 08:19 PM 3,537 settings.py
02/19/2011 08:19 PM 2,215 settings.pyc
02/19/2011 07:58 PM templates
02/19/2011 08:17 PM 832 urls.py
02/19/2011 08:18 PM 655 urls.pyc
02/19/2011 11:26 AM 0 __init__.py
02
rm},
context_instance=RequestContext)
See the documentation:
http://docs.djangoproject.com/en/1.2/ref/templates/api/#subclassing-context-requestcontext
(the Note box, a couple of screens down - unfortunately there's no handy id
to link to directly)
--
DR.
--
You received this message because y
Hi,
It's been some time I haven't used the messages framework but don't you see
your messages with some lags ?
Like try to submit twice your form and see if you don't get the messages after
the second post (and don't go in the admin between those requests).
When forms are valid, I usually
Hi all, I'm trying to use messages framework, I've checked that
middleware, context processor and app is well configured (I'm running
django development version which a standard manage.py startproject
includes all needed stuff)
So, let me write a little bit of code, assume a model like:
class
tion that I decide to use:
> >http://stackoverflow.com/questions/4993625/django-templates-form-fiel...
> > -as-variable
>
> I like it too, but aren't you still stuck with validating it or are you
> applying a validator to each field you generate this way?
>
> Mike
> --
>
ch
> field of form :(
> .
> There is another solution that I decide to use:
> http://stackoverflow.com/questions/4993625/django-templates-form-field-name
> -as-variable
I like it too, but aren't you still stuck with validating it or are you
applying a validator to each field you generate this way?
/django-templates-form-field-name-as-variable
--
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...@google
On Monday, February 14, 2011 07:00:38 am ju wrote:
> How can I make this loop to print form fields where is the
> value of ticket.id?
>
> {% for ticket in zone.tickets %}
> {{ ticket.id }}: {{ form.ticket_count_ }}
> {% endfor %}
>
> So the output to be something like
How can I make this loop to print form fields where is the
value of ticket.id?
{% for ticket in zone.tickets %}
{{ ticket.id }}: {{ form.ticket_count_ }}
{% endfor %}
So the output to be something like this...
1:
10:
12:
3:
--
You received this message because you are
I see now what you mean. I can really use that.
Thanks for the answer!
Michael
2011/1/27 Shawn Milochik <sh...@milochik.com>
> I think you're looking for context processors.
>
>
> http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors
>
I think you're looking for context processors.
http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors
You write functions that add to the context each page receives. That info is
available in the template regardless of which view called the rendering.
Shawn
Hello everyone,
I'm a while busy with coding in Django applications.
Now i have a question, because what I want to do,
doesn't work right.
if I request the url: http://localhost/shorts/
I have a short template who gives me messages.
This template is loaded in a default template base.html.
Now
On Fri, Jan 21, 2011 at 2:59 PM, km <srikrishnamo...@gmail.com> wrote:
> Hi all,
>
> The docs say we can have multiple child templates extending the parent
> template. But then how to render multiple child templates in one call ?
>
> regards,
> KM
>
I don't thin
Hi all,
The docs say we can have multiple child templates extending the parent
template. But then how to render multiple child templates in one call ?
regards,
KM
On Fri, Jan 21, 2011 at 8:14 PM, km <srikrishnamo...@gmail.com> wrote:
>
> Hi all,
>
> On Fri, Jan 21, 2011
d automatically.
>> both base.html and child html are in the same dir.
>> I am using django 1.2.4 on ubuntu 10.10
>> what could be the problem?
>>
>> pls let me know.
>> regards,
>> KM
>>
>
> You're doing it the wrong way round. Child templa
problem?
>
> pls let me know.
> regards,
> KM
>
You're doing it the wrong way round. Child templates extend parent
templates, so you need to render the child.
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
he browser(firefox 3.x) but the child html
> pages, holding content details, which extend base.html does not get pulled
> automatically.
> pls let me know.
Um. It sounds like you've misunderstood something about how the template
inheritance mechanism works or what it's for. Do you expect
On Fri, Jan 21, 2011 at 12:08 PM, km wrote:
> Hi all,
>
> I am trying to display a parent django template (base.html) with a view
> function called "base" like this:
>
> def base(request):
> return render_to_response('base.html')
>
> The base.html gets displayed in
Hi all,
I am trying to display a parent django template (base.html) with a view
function called "base" like this:
def base(request):
return render_to_response('base.html')
The base.html gets displayed in the browser(firefox 3.x) but the child html
pages, holding content details, which
class EmailNotificationTest(BaseTestCase):
"""
Test Class for testing email notification
"""
urls = 'notification.urls'
def test_create_notification(self):
res = self.client.get('email/create/) # will fail
self.assertEquals(res.status_code, 200)
If I
oups.com
Subject: Re: ReportLab and Django - templates? ; FK object has no
attribute split
Hi Victor,
It really depends on complexity of your PDF. I needed to do
something similar some time ago and used ReportLab addon called "pisa"
and used standard Django template language to define
You can put the templates anywhere you want, by a good place is a
directory named templates in the base directory of your project, i.e.
C:\DjangoProjects\mysite\templates\
Don't forget to add this path to the TEMPLATE_DIRS variable in your settings.py.
The template file from the example would
<mo.mughr...@gmail.com> wrote:
> By document root they mean apache public directory, aka htdocs
>
> Sent from my iPhone
>
> On Jan 3, 2011, at 4:53 PM, Anthony Pearce <coden...@gmail.com> wrote:
>
>
>
> > In Tutorial 2, I was instructed to make a
By document root they mean apache public directory, aka htdocs
Sent from my iPhone
On Jan 3, 2011, at 4:53 PM, Anthony Pearce <coden...@gmail.com> wrote:
> In Tutorial 2, I was instructed to make a templates directory. It is
> located at:
> C:\DjangoProjects\mysite\template
701 - 800 of 2417 matches
Mail list logo