Hi,
I want to include a file using {% include "header.html" %}
However I want to be able to dynamically use different files then
"header.html"
Obviously {% include {{ include_filename }} %} does not work.
Can I make this work somehow?
--~--~-~--~~~---~--~~
You
Hi Graham,
On Fri, 2009-03-06 at 21:50 -0800, Graham Dumpleton wrote:
[...]
> I am still toying with whether I add a few things or not. The first of
> these is optionally enabled support in daemon mode for X-Sendfile
> header where sending of file is actually performed back in main Apache
> worke
Keep track of a variable which tells us the action user is currently
doing like "draft,publish,edit "?
the first time the user does a publish you need to trigger an action.
details:
How to know the current action of user?
---
a) 1.
Keep track of a variable which tells us the action user is currently
doing like "draft,publish,edit "?
the first time the user does a publish you need to trigger an action.
details:
How to know the current action of user?
---
a) 1.
On Fri, 2009-03-06 at 22:09 -0800, Vbabiy wrote:
> I know django does not support STI,
Based on what follows, I guess you mean "single table inheritance",
meaning all columns for all models in the same table.
> but I was wondering if there is
> any way I can implement this behaviour.
>
> Here
On Sat, 2009-03-07 at 00:28 -0800, jago wrote:
> Hi,
>
> I want to include a file using {% include "header.html" %}
>
> However I want to be able to dynamically use different files then
> "header.html"
>
> Obviously {% include {{ include_filename }} %} does not work.
>
> Can I make this work
Oh, actually I tried that but when it didn't work I got creative with
{% include {{ include_filename }} %}
I believe my problem is somewhere else.
In my main HTML file index.html I use {% include "header_viz_js.html"
%}
in header_viz_js.html I use {% include template_name %}
Result: header_vi
Sorry. Found the problem. My bad - simple stupidity.
--~--~-~--~~~---~--~~
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 gr
On Mar 7, 7:29 pm, Malcolm Tredinnick
wrote:
> Hi Graham,
>
> On Fri, 2009-03-06 at 21:50 -0800, Graham Dumpleton wrote:
>
> [...]
>
> > I am still toying with whether I add a few things or not. The first of
> > these is optionally enabled support in daemon mode for X-Sendfile
> > header where
Unfortunatly I still haven't found a solution and I tryed it with and
without a trailing /.
No difference.
I will post the solution, if there is one and if I find it. :)
-Tom
On 5 Mrz., 16:39, Francis wrote:
> Did you found any solution?
>
> Because I have the same problem, but on opposite si
>> class Tracker(models.Model):
>>notifications = models.ForeignKey(Notification)
>>
>> class Notification(models.Model):
>> # Common fields
>> pass
>>
>> class EmailNotification(Notification):
>>pass
>>
>> class SmsNotification(Notification):
>>pass
>>
>>
>> # I would be able
Hi Everybody...
I am trying out the Django-logging Middleware for my application.
I am using Ubuntu as an OS, with Python Version 2.5 and Django Version
0.97-pre-SVN-7049.
I just tried the way they specified in the following link
http://code.google.com/p/django-logging/wiki/Overview
This is m
How would generic relations solve this problem, It has been recommend for me
to look at it a few times but I can't seem to understand how it would work.
Vitaly Babiy
On Sat, Mar 7, 2009 at 7:50 AM, Tim Chase wrote:
>
> >> class Tracker(models.Model):
> >>notifications = models.ForeignKey(No
Hi all. Im wondering about an admin modification. I've managed to
create a few ajax forms for the admin interface of django before now
but I'm what I'm really after is getting the user to upload an image.
This image is saved "somewhere" and the next page of the form comes
up. This page has my ajax
On Sat, Mar 7, 2009 at 8:22 AM, Oni wrote:
>
> Hi all. Im wondering about an admin modification. I've managed to
> create a few ajax forms for the admin interface of django before now
> but I'm what I'm really after is getting the user to upload an image.
> This image is saved "somewhere" and the
Thats not quite what I mean. The AJAX bit is only there to get a set
of co-ordinates that will be passed to PIL to do its stuff. In fact,
forget Ajax for now. What i want is a multipart form in the admin
section BUT the image uploaded in the first form MUST be available in
the second form.
One wa
On Sat, Mar 7, 2009 at 12:50 AM, Graham Dumpleton
wrote:
> BTW, if there is anything else you would like to see in mod_wsgi, now
> is the time to speak up as am close to point where can wrap up work on
> mod_wsgi 3.0.
For the sites I work on, mod_wsgi is already basically perfect (to the
point t
Wonderful! Thank you so much for the help.
Brandon
On Mar 6, 3:24 pm, Rajesh D wrote:
> > I'm working on some code to scrub an images directory of anything not
> > currently stored in the database, and would like to de-couple some
> > things. I'm using signals, passing in an instance of a model
Ahh. Searching for "compressed fixtures" on djangoproject.com under the
"1.0" documentation option reveals the following page:
http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs
That page has the "1.0 Docs" label, so I'm guessing this is an error in the
documentation? Is there
I've read the doc several times but am still confused by the way
Django references URLs. I'm running Python 2.4 and Django 1.0.2 on my
Debian Etch box.
My urls.py reads:
from django.conf.urls.defaults import *
from django.conf import settings
urlpatterns = patterns('my_proj.my_app.vie
Is it possible to include a field in a ModelForm, and display it with
its default widget, but include the readonly="1" attribute so it's not
editable?
I don't want to make the corresponding Model field not editable, and I
don't want to reinvent all the default widgets just to add the
readonly att
On Fri, Mar 6, 2009 at 12:57 PM, rajeesh wrote:
>
> You may change the save_model() method of corresponding AdminClass for
> that:
> e.g, to set the attribute 'a' of model 'Book' , write inside
> BookAdmin.save_model() something like this:
>
> obj.a = form.cleaned_data['another_key'] * 2
> obj.sa
Hi,
I have an app with countries and counties. The simplified model is:
class Country(models.Model):
name = models.CharField(max_length=50)
slug = models.SlugField()
def __unicode__(self):
return self.name
class County(models.Model):
name = mode
Sorry, the correct url would be domain.com/country/county/
On Mar 7, 5:42 pm, Jamie Pittock wrote:
> Hi,
>
> I have an app with countries and counties. The simplified model is:
>
> class Country(models.Model):
> name = models.CharField(max_length=50)
> slug = models.SlugField()
I'm finding random instances in my application where a new user
registers or an existing user changes their password and then can't
log in the next time because their account is no longer active. It
doesn't happen consistently, which is driving me crazy. I am not
using the authentication views t
On Mar 7, 4:27 pm, timlash wrote:
> I've read the doc several times but am still confused by the way
> Django references URLs. I'm running Python 2.4 and Django 1.0.2 on my
> Debian Etch box.
>
> My urls.py reads:
>
> from django.conf.urls.defaults import *
> from django.conf import settin
On Mar 7, 5:42 pm, Jamie Pittock wrote:
> Hi,
>
> I have an app with countries and counties. The simplified model is:
>
> class Country(models.Model):
> name = models.CharField(max_length=50)
> slug = models.SlugField()
>
> def __unicode__(self):
> return
I see. Thanks.
I've been using render_to_response() without difficulties. Under what
conditions should I use reverse() vs. render_to_response()? Can they
be used interchangeably?
Thanks again,
Tim
On Mar 7, 2:37 pm, Daniel Roseman
wrote:
> On Mar 7, 4:27 pm, timlash wrote:
>
>
>
> > I've
I'm trying to figure out a way to use the django.contrib.auth tools at
the root of the site for login but I'm running into one issue (I know
I can write my own viewbut not trying not to do that here).
So I have this in my urls.py
(r'^$', login, {'template_name':'login_base.html'}),
so when
I am using django 1.1 and MYSQL 5.0 with collation utf8_unicode_ci
I have no problems storing unicode strings to database, but when I try
to render a template using any of these chars ñáéíóúÑÁÉÍÓÚ from
database, it throws a TemplateSyntaxError, what should I do ?
--~--~-~--~~-
Thanks Daniel. Yeah it's just a way of getting the county so I'll try
your second option. Could you possibly point me to the docs that
explain the double underscore?
On Mar 7, 7:39 pm, Daniel Roseman
wrote:
> On Mar 7, 5:42 pm, Jamie Pittock wrote:
>
>
>
>
>
> > Hi,
>
> > I have an app with c
On Sat, Mar 7, 2009 at 1:59 PM, jmat wrote:
>
> I'm trying to figure out a way to use the django.contrib.auth tools at
> the root of the site for login but I'm running into one issue (I know
> I can write my own viewbut not trying not to do that here).
>
> So I have this in my urls.py
>
> (r'
On Sat, Mar 7, 2009 at 3:07 PM, juanefren wrote:
>
> I am using django 1.1 and MYSQL 5.0 with collation utf8_unicode_ci
>
Django 1.1 doesn't exist yet, so I guess you are either running 1.1 alpha1
or an SVN trunk checkout. I doubt the specific version really matters here
(since full unicode s
On Sat, Mar 7, 2009 at 11:17 AM, Ben Davis wrote:
> Ahh. Searching for "compressed fixtures" on djangoproject.com under the
> "1.0" documentation option reveals the following page:
> http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs
>
> That page has the "1.0 Docs" label, so I
On Mar 7, 8:21 pm, Jamie Pittock wrote:
> Thanks Daniel. Yeah it's just a way of getting the county so I'll try
> your second option. Could you possibly point me to the docs that
> explain the double underscore?
It's the standard syntax for lookups across relationships. See
http://docs.djangop
On Sat, Mar 7, 2009 at 3:08 PM, Karen Tracey wrote:
> On Sat, Mar 7, 2009 at 11:17 AM, Ben Davis wrote:
>
>> Ahh. Searching for "compressed fixtures" on djangoproject.com under the
>> "1.0" documentation option reveals the following page:
>> http://docs.djangoproject.com/en/dev/ref/django-admin
I'm reading the documentation on sessions (http://
docs.djangoproject.com/en/dev/topics/http/sessions/?from=olddocs) and
saw the following example:
def post_comment(request, new_comment):
if request.session.get('has_commented', False):
return HttpResponse("You've already commented.")
On Mar 7, 7:59 pm, timlash wrote:
> I see. Thanks.
>
> I've been using render_to_response() without difficulties. Under what
> conditions should I use reverse() vs. render_to_response()? Can they
> be used interchangeably?
>
> Thanks again,
>
> Tim
>
Eh? They do completely different jobs.
re
On Mar 7, 9:42 pm, Rex wrote:
> I'm reading the documentation on sessions (http://
> docs.djangoproject.com/en/dev/topics/http/sessions/?from=olddocs) and
> saw the following example:
>
> def post_comment(request, new_comment):
> if request.session.get('has_commented', False):
> retur
What's the best way to include a form in every page, such as a search
form in the header?
You could stuff a blank form in with a context processor, and override
that variable in the actual search view so you can fill in the term
that searched for.
Or do people prefer a template tag? Or somethin
On Sat, Mar 7, 2009 at 4:03 PM, luell.m...@gmail.com
wrote:
>
> What's the best way to include a form in every page, such as a search
> form in the header?
>
> You could stuff a blank form in with a context processor, and override
> that variable in the actual search view so you can fill in the te
What variable? The search term?
So your search view gets the query and does the actual search, then
stuffs results and search_term (or something) into the context, and
passes search_term into the template tag?
Making sure I got it, that does sound better.
Thanks.
On Mar 7, 4:25 pm, Alex Gay
On Sat, Mar 7, 2009 at 4:29 PM, luell.m...@gmail.com
wrote:
>
> What variable? The search term?
>
> So your search view gets the query and does the actual search, then
> stuffs results and search_term (or something) into the context, and
> passes search_term into the template tag?
>
> Making sure
I've been looking into both the "South" and "django-evolution" migration
frameworks. There are things I like about both of them, although I'm
leaning towards django-evolution.
The thing I like about django-evolution is that migrations are described in
the same "language" as your model, that is,
When using a modelform there are some ways to get you where you want.
You can get your form using request.POST. If it validates you can save
it like this creating a model.
record = form.save(commit=false)
record.key = 123
record.save()
Now, I cant remember but I believe that if you add missing k
A fixed migration is the code run to get from one step to another.
Migrations uses the, maybe at some point you needed to add an extra
table to the db. Then you could write a migration that would add the
table if you wanted to progress or delete the table if you wanted to
get back. You would have
Hi,
I have a model with a recursive relation:
class Category(models.Model):
name = models.CharField(max_length=100, blank=False,
db_index=True)
parent_category = models.ForeignKey('self',
related_name='child_categories', blank=True, null=True)
And I want it's members to be ordered with
On Sat, 2009-03-07 at 06:50 -0600, Tim Chase wrote:
[...]
> A slightly less DRY solution than ideal (ideal=solving the VERY
> complex STI problem in Django's ORM),
Um .. no. That's the one thing that is almost certainly not going to
happen. Single-table inheritance --- a.k.a shoving all your col
On Sat, 2009-03-07 at 08:29 -0800, Chris wrote:
[..]
> Others have posted similar questions in this forum, but it doesn't
> look like anyone's found a good solution to this problem.
There have been plenty of reasonable solutions posted to the forum. It's
close to trivial to write a class to displ
On Sat, 2009-03-07 at 10:12 -0800, jeff wrote:
> I'm finding random instances in my application where a new user
> registers or an existing user changes their password and then can't
> log in the next time because their account is no longer active. It
> doesn't happen consistently, which is drivi
On Sat, 2009-03-07 at 13:42 -0800, Rex wrote:
> I'm reading the documentation on sessions (http://
> docs.djangoproject.com/en/dev/topics/http/sessions/?from=olddocs) and
> saw the following example:
>
> def post_comment(request, new_comment):
> if request.session.get('has_commented', False):
On Sat, 2009-03-07 at 16:37 -0800, NicoEchániz wrote:
> Hi,
>
> I have a model with a recursive relation:
>
> class Category(models.Model):
> name = models.CharField(max_length=100, blank=False,
> db_index=True)
> parent_category = models.ForeignKey('self',
> related_name='child_categori
On Mar 7, 5:12 pm, Malcolm Tredinnick
wrote:
> Sure, "request" is a local variable, but since Python uses
> pass-by-reference, it is a reference to an object that is also
> referenced by other variables in other scopes (including the session
> middleware).
>
> So by assigning to request.session,
> Now, I cant remember but I believe that if you add missing key data in
> cleaned method, giving the name django would expect, you would be able
> to just save the form. You could also just manually access the key
> field from the cleaned_data and apply it on the model.
Unfortunately, this isn't
Figured it out.
I had a model form that included is_active as a field, but that field
was not being displayed in the form for regular users. It was
evidently unsetting the value.
On Mar 7, 5:08 pm, Malcolm Tredinnick
wrote:
> On Sat, 2009-03-07 at 10:12 -0800, jeff wrote:
> > I'm finding rando
Is it possible to use variable attributes in templates, something like
the following (which does not work of course), where form is a
dictionary and attribs is a list of attribute strings?
{% for attrib in attribs %}
{{attrib}}: {{form}}.{{attrib}}
{% endfor %}
--~--~-~--~~-
On Sat, 2009-03-07 at 18:54 -0800, only wrote:
> Is it possible to use variable attributes in templates, something like
> the following (which does not work of course), where form is a
> dictionary and attribs is a list of attribute strings?
>
> {% for attrib in attribs %}
> {{attrib}}: {{fo
Hi everyone,
Syntax trouble. My post_save signal is defined as:
def scrub_directory(sender, instance, **kwargs):
pass
When I attempt to pass a keyword arg to it:
models.signals.post_save.connect(scrub_directory, sender=TheModel,
{'my_kwarg' : 'some_value'})
I get a syntax error: keyword
On Sat, Mar 7, 2009 at 5:25 PM, Alex Gaynor wrote:
> My strategy would be to make a template tag that was passed the variable and
> rendered that if there was data, else created and rendered a blank form.
Or, you know, you could just put a form in the base template. You
know, `...`. Really, don'
Thanks Malcolm for the response,
I am only really instressed in the last part:
The "complex" thing that we might do, one day, is providing a way to
also retrieve all the descendents from a base table. It won't be
particularly efficient, but that's because SQL is relational and not
object-oriented.
On Sat, Mar 7, 2009 at 11:14 PM, Brandon Taylor wrote:
> When I attempt to pass a keyword arg to it:
>
> models.signals.post_save.connect(scrub_directory, sender=TheModel,
> {'my_kwarg' : 'some_value'})
>
> I get a syntax error: keyword argument appeared after a non-keyword
> argument.
Well, you
Hi Jacob,
Thanks for the reply. My fault - I misread the post_save
documentation, and thought it was able to accept **kwargs. I was able
to work around the problem another way by just adding a @property to
the model in question I can call from the instance passed to the
signal.
Brandon
On Mar 7
Dear All,
I ran into the following error of "IntegrityError: columns app_label,
model are not unique" when I tried to
Sync the data to the db with the command of "manage.py syncdb". I am
using python2.5, Django-1.0.2-final, and Window XP.
Could anyone be kindly to tell me how to solve this problem
Hi there,
I'm an experienced developer, but new to Django. I've experimented
with Django over the years, but I'm now in the process of planning a
medium sized Django app. We have an in-house support/email system
written in python, but it needs an overhaul. :)
The application will become a sim
On Sat, 2009-03-07 at 21:29 -0800, Matt Doran wrote:
> Hi there,
>
> I'm an experienced developer, but new to Django. I've experimented
> with Django over the years, but I'm now in the process of planning a
> medium sized Django app. We have an in-house support/email system
> written in python
Hi Malcolm,
Thanks for the very detailed (and well thought-out) response! Greatly
appreciated.
On Mar 8, 4:57 pm, Malcolm Tredinnick
wrote:
> On Sat, 2009-03-07 at 21:29 -0800, Matt Doran wrote:
>
> > Is there a recommended best-practice approach to this type of
> > project? Or maybe even poi
On Sat, 2009-03-07 at 22:59 -0800, Matt Doran wrote:
[...]
> The whole
> "startproject" thing and the default layout feels like it's forcing me
> to make decisions that I'm not ready to (i.e. it's on page 1 of the
> tutorial).
Hmmm. "startproject" doesn't require you to make any decisions at al
67 matches
Mail list logo