Re: Automatic {% load %} ?

2009-10-04 Thread Vitaly Babiy
Hey take a look at this http://stackoverflow.com/questions/1184983/load-a-django-template-tag-library-for-all-views-by-default Vitaly Babiy On Sun, Oct 4, 2009 at 10:07 PM, Christophe Pettus wrote: > > In my templates, I'm making reasonably heavy use of custom tags. Is >

Automatic {% load %} ?

2009-10-04 Thread Christophe Pettus
In my templates, I'm making reasonably heavy use of custom tags. Is there a way to avoid having to have the template authors put the {% load %} tags at the top of each template, since pretty much every single template is going to need to load the same set? -- -- Christophe Pettus

Re: decoupled url confs- can't reach admin page now

2009-10-04 Thread Christophe Pettus
On Oct 4, 2009, at 6:21 PM, Ross wrote: > Could the problem be > that I have not written views for everything that the urlconf > references? Precisely. The documentation that Karen Tracey mentions discusses this: http://docs.djangoproject.com/en/dev/topics/http/urls/#reverse -- --

Re: decoupled url confs- can't reach admin page now

2009-10-04 Thread Ross
I'm struggling to find where the error is in my urlconf. When that line I referenced previously is uncommented, I am able to get to the other pages for which I have made views (which is just the home page at the moment), but I can't access the admin. Could the problem be that I have not written

Re: decoupled url confs- can't reach admin page now

2009-10-04 Thread Karen Tracey
On Sun, Oct 4, 2009 at 3:39 PM, Ross wrote: > > I was going through the tutorial and following directions (I think) > when it instructed me to decouple the url confs near the end of part 3 > of the Django Tutorial. After I did this, I was no longer able to > reach the admin

Re: Generating a single form with OneToOneField

2009-10-04 Thread Russell Keith-Magee
On Sat, Oct 3, 2009 at 2:55 AM, Tiago Samahá wrote: > > Hello All, > > i'm trying generate a single form with two models. > > class Contact(models.Model): >    phone = models.CharField(max_length=8) >    email = models.CharField(max_length=50) > > class

Re: Run a filter on path in {% extends %} tag?

2009-10-04 Thread Kristaps Kūlis
Hello, Just use RequestContext + context processor, which adds theme based context. Just use vars like base_template (which could be set to skin_basic_base.html by context processor). Hope you got the idea. Kristaps Kūlis What this country needs is a good five cent

Re: Did the django tutorial change recently?

2009-10-04 Thread Kristaps Kūlis
Hello, I believe that http://djangobook.com/ uses books / publishers etc on examples. DjangoProject tutorial is about poll based app. Kristaps Kūlis What this country needs is a good five cent

Did the django tutorial change recently?

2009-10-04 Thread Vince
A couple months ago I was working through the django tutorials and ended up having to take a break for a while. I believe they were on the djangoproject website. However, I can't seem to find the tutorial I was working on before, which started with pages that could display the time based on

Run a filter on path in {% extends %} tag?

2009-10-04 Thread ringemup
I'd like my templates to extend different templates depending on the skin the user has selected.The trouble is that the {% extends %} tag has to appear in the template file before any custom filters are loaded, so I can't run something like {% extends 'wrapper.html'|select_theme:user_theme

Re: Generating a single form with OneToOneField

2009-10-04 Thread Tiago Samahá
Someone can help me? Thanks. On 2 out, 15:55, Tiago Samahá wrote: > Hello All, > > i'm trying generate a single form with two models. > > class Contact(models.Model): >     phone = models.CharField(max_length=8) >     email = models.CharField(max_length=50) > > class

Re: trying to do ip based resolve

2009-10-04 Thread Kurt Neufeld
Wow, was that ever easy. Thanks for your help! Kurt For future googlers: settings.py: MIDDLEWARE_CLASSES = ( ... 'redirector.ConstructionFilterMiddleware', ... ) redirector/__init__.py: from django.shortcuts import render_to_response from django.conf import settings class

Re: Is it possible to use custom template tag inside another tag?

2009-10-04 Thread AmanKow
> custom tag is a function  - cant you just assing its return in view > into variable and send this variable to template? The usual way to go about this would be to modify your tag to take an optional "as var_name". When the tag has the optional portion, you would update the value into the

Re: First tutorial - Not off to a good start :(

2009-10-04 Thread Leke
> The script seems to be missing the x bits for execution. > Try >     $ python /usr/lib/python-django/bin/django-admin.py startproject mysite You were right. I forgot all about needing to call python. Thanks to you both for your help. --~--~-~--~~~---~--~~ You

decoupled url confs- can't reach admin page now

2009-10-04 Thread Ross
I was going through the tutorial and following directions (I think) when it instructed me to decouple the url confs near the end of part 3 of the Django Tutorial. After I did this, I was no longer able to reach the admin page. Now, whenever I try to reach the admin, I get this error message:

Re: trying to do ip based resolve

2009-10-04 Thread Kristaps Kūlis
You should and must do such things at middleware (as god intended). example: http://www.djangosnippets.org/snippets/845/ just return custom HttpResponse, not HttpResponseForbiden Kristaps Kūlis On Sun, Oct 4, 2009 at 8:41 PM, Kurt wrote: > > > I think I must be

trying to do ip based resolve

2009-10-04 Thread Kurt
I think I must be doing something fundamentally wrong since this seems like an easy problem... I'm building a site, I want all ips not in INTERNAL_IPS to get an "under construction" page and my internal ips to get the real site. What I'm trying to do is call the application urlconf via the

About conditional view processing: ETags

2009-10-04 Thread Torsten Bronger
Hallöchen! So far, I've used only the "last-modified" function for conditional view processing, which worked nicely. Now, I have a view which may switch between certain states, which makes "last-modified" less useful. I implemented an ETags function for the "conditional" decorator but it

Re: First tutorial - Not off to a good start :(

2009-10-04 Thread Markus Stumpf
On Sun, Oct 04, 2009 at 10:43:11AM -0700, Leke wrote: > I still seem to have no luck running the script though... > > l...@leke ~/Projects/cms/django $ /usr/lib/python-django/bin/django- > admin.py startproject mysite > bash: /usr/lib/python-django/bin/django-admin.py: Permission denied The

Re: First tutorial - Not off to a good start :(

2009-10-04 Thread Leke
Ah yes, I see what you mean about the dot (.) I still seem to have no luck running the script though... l...@leke ~/Projects/cms/django $ /usr/lib/python-django/bin/django- admin.py startproject mysite bash: /usr/lib/python-django/bin/django-admin.py: Permission denied l...@leke

ManyToMany filtering

2009-10-04 Thread Weeble
I have a model that represents interdependent tasks. A task cannot be started until all of its prerequisite tasks have been completed. I want to find all the tasks which are ready to start, i.e. all their prerequisite tasks (if any) have been completed. This is the relevant part of the model:

Re: First tutorial - Not off to a good start :(

2009-10-04 Thread Karen Tracey
On Sun, Oct 4, 2009 at 12:29 PM, Leke wrote: > > I've just installed python-django from my ubuntu repositories and > tried my luck at the tutorial here: > http://docs.djangoproject.com/en/dev/intro/tutorial01/ > > I tried running django-admin.py startproject mysite but

First tutorial - Not off to a good start :(

2009-10-04 Thread Leke
I've just installed python-django from my ubuntu repositories and tried my luck at the tutorial here: http://docs.djangoproject.com/en/dev/intro/tutorial01/ I tried running django-admin.py startproject mysite but discovered it not to be on my system path. The tutorial says "If it’s not on your

A question about model form inheritance

2009-10-04 Thread Vasil Vangelovski
Lets say I have one form which inherits from ModelForm and a second one that inherits from the first one. What I want to do is add 2 fields in the second form, the fields are bound to the properties of the model. Which would be the best way to do this? Example: the model has fields: name,

Re: How to change name for model in Admin?

2009-10-04 Thread Rodrigo Cea
Please post the actual code that's not working. This should work regardless of the value of verbose_name. Rodrigo On Oct 3, 7:51 pm, adelaide_mike wrote: > Thanks for the pointer. > > I find that the verbose_name works as advertised in the case of a > model named

Re: OperationalError: unable to open database file, when saving existing object

2009-10-04 Thread pigmalione
For what it's worth, I found some kind of solution. Apparently, running under a user administrator account in Windows causes this kind of permissioning issue. If I enable the windows hidden administrator and work under that account, this issue disappears. A bit annoying.

Re: Sites module, URLs and templates

2009-10-04 Thread Kristaps Kūlis
Hi! You can make settings for each site easily first_settings.py from settings import * SITE_ID = 1 TEMPLATE_DIRECTORIES = ( [ ] ) [ other settings, which needs to be overrided ] you can also override urls, etc with revelant settings. if you want to use manage.py, you will need to use copy

Re: Will it lost some features(middleware/contextprocessor) of Django when using Jinja2 ?

2009-10-04 Thread Kristaps Kūlis
Hi! You can use RequestContext (and also middlewares and context processor). Just pass it to jinja2 render method like this template.render(**context) See this blog post: http://lethain.com/entry/2008/jul/22/replacing-django-s-template-language-with-jinja2/ On Sun, Oct 4, 2009 at 2:36 AM,

Re: filter magic to support i18n models

2009-10-04 Thread Jani Tiainen
k88 kirjoitti: > Given the following models > > class Product(models.Model): > price = models.IntegerField() > > class Product1I18n(models.Model) >parent = models.ForeignKey(Product) >language = models.CharField(max_length=2) >title = models.CharField(max_length=255) >