Re: Templates, filesystem, caching?

2007-12-22 Thread Rob Hudson

On 12/21/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> In the early days of Django, Adrian, Simon et al looked at that. It
> wasn't worth it, since, in the grand scheme of things, template caching
> and checking the cache wasn't that much faster than loading and parsing,
> particularly in the overall response time of a request (of which
> template parsing is a relatively small component). Adding complexity for
> minimal gain isn't usually a good idea. Unless this is a universal win,
> it would be better to write it as a third-party template loader. It's
> fairly easy to write a template loader that takes another template
> loader as a parameter and just wraps caching around it and that keeps
> the core code cleaner.

I wonder if the template system has become a bit more complex since
then.  I also wonder if whatever tests they used included things like
includes in for loops.  I tend to think that the filesystem is slow
and anything to remove FS calls and shove things in memory is a good
thing -- especially something that could potentially be in a for loop.
 Obviously there are trade-offs as you mention but the patch didn't
look that complex to me -- actually it was surprisingly straight
forward.

I've considered applying this patch and testing against a project I'm
working on.  Maybe that would help prove to either Django or me that
this is or isn't worth it.

Thanks,
-Rob

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django for a seminar registration app?

2007-12-22 Thread Kenneth Gonsalves


On 23-Dec-07, at 10:42 AM, Nicolai Richter (Gm) wrote:

> Do you think Django could handle the task easily or do you think
> something else would be better? What do you think will be the hardest
> part to implement? And how many hours/days/weeks would you think it
> takes a new user like me to get the thing up? Ideally I would have a
> showcase demo with limited functionality up in 6 or 7 days (of which I
> can spend maybe 4 hours each day on it).
> Do you think that s possible?

dead easy - you could even take a look at this (feel free to  
cannibalise it as long as you give us some credit), or you could add  
your seminar stuff as a module and we would help out there:

http://registration.fossconf.in/web/
and
http://registration.fossconf.in/code/

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django for a seminar registration app?

2007-12-22 Thread Nicolai Richter (Gm)

Dear Django experts,

I am a python programmer with about 1.5 years part-time python
experience and some web site building experience. I am about to take a
project of building a seminar registration site for a client.

I have already decided I want to handle that project in python, but I
have a hard time deciding which framework to use. Django, Pylons and
Turbogears all seem reasonable candidates. I like Django for its
active community and development and the somewhat more coherent
framework (it seems to me), Turbogears for its widgets, and about
Pylons I havent't read/dabbed enough yet.

I heard that most things work great out of the box with Django, but
beware if they dont! Also, Django seems to be geared more towards
publishing by one or a few users, while my task will be more about
many users managing their own resources. (see below)
With Turbogears I haven't gotten many examples work out right away,
and with neither I have been able to quickly have a authorized-access
based web site up. I haven't tried for more than 1-2 hour per
framework  though. Pylons I havent really tried enough (and was a
little discouraged to hear it might get overridden a lot with the
merge into TG).

I am now looking for help in choosing a framework and estimating the
effort it takes to build the app. The project will have to be done in
under 3 weeks, so I can't really afford to run into dead ends and
restart with a different framework. :-/

The main functions of project will be:

 - let users register (with or without email verification)

 ONLY AFTER registration

 - let users select from a list of seminar dates
 - register for a seminar (probably only 1 per user)
 - unregister from seminars until seimnar_start_date-X days
 - manage their data
 - get an e-mail X days before the seminar (probably cron job)

 have an admin (the seminar speaker) be able to

 - CRUD seminar dates
 - generate participant lists
 - print invoices


There will be some restraints like minimum number of participants for
a seminar for it to take place, probably batches of seminars (2 or 3
per day) that will get canceled if one of the gets canceled. I think
that should be relatively painless with some python functionality.

The main questions I have right now are:

Do you think Django could handle the task easily or do you think
something else would be better? What do you think will be the hardest
part to implement? And how many hours/days/weeks would you think it
takes a new user like me to get the thing up? Ideally I would have a
showcase demo with limited functionality up in 6 or 7 days (of which I
can spend maybe 4 hours each day on it).
Do you think that s possible?

Very much looking forward to any hints, pointers and comments,


Nico Richter


(P.S. I will post this to the Django, Pylons and Turbogears groups, so
please forgive me if you get this more than once. If you are in
several of these groups, YOU are the guy I wish I would get a reply
from ;-)) )
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django documentation in chm (Dec 22, 2007)

2007-12-22 Thread [EMAIL PROTECTED]

Thanks for your done.

But I can't get the django-documetn-chm for your given url.

Can you send a copy to my email [EMAIL PROTECTED] please?

Thank you very much, Merry Christmas to you...  ^_^



On 12月22日, 下午9时36分, char101 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have created a chm format of the django docs taken from svn at Dec
> 22, 2007.
>
> Link:http://charupload.wordpress.com/2007/12/02/django-documentation-chm/
>
> Note: don't right click and save as on the links because it's a link
> to a page on divshare, not a direct link to the file.
>
> Cheers,
> Charles
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: App for rendering and far future caching of css and js files

2007-12-22 Thread Itai Tavor

On 11/11/2007, at 8:27 PM, Itai Tavor wrote:

> Hi all,
>
> I made one of them apps, like the subject says...
>
> From the README (which is as well as I can explain it, if I could
> say it better I'd edit the README, right?):
>
> The app provides two main functions:
>
> 1. Render and serve css files based on django templates.
>
> To aid in generating css code, the context of templates rendered
> by this app includes urls for accessing site media, as well as
> developer-specified custom variables.
>
> Css content is served with caching tags instructing browsers to
> cache the files for one year, needed to make the link tags generated
> by the app effective (see below).
>
> 2. Render  and 

Re: How to initialize M2M field in new ModelForm?

2007-12-22 Thread Joseph Kocherhans

On 12/22/07, Yatla <[EMAIL PROTECTED]> wrote:
>
> I need to initialize a selection in a M2M field of the Document
> ModelForm during the first GET of a form that creates a new Document -
> classes and view as follows:
>
> class DocumentForm(forms.ModelForm):
> class Meta:
> model = Document
>
> class Document(models.Model):
> ...
> categories = models.ManyToManyField(Category)
>
> view function:
> def create(request, category_name, template='edit2.html', params={}):
> category = get_object_or_404(Category, name=category_name)
> new_doc = Document(author=request.user, pub_date=datetime.now())
> if request.method == 'POST':
> form = DocumentForm(request.POST, instance=new_doc)
> if form.is_valid():
> .
> else:
> form = DocumentForm(instance=new_doc)  # todo: figure out how
> to initialize categories
> params['form'] = form
> return render_to_response(template, params,
> RequestContext(request))

Are you trying to assign all new docs to an existing Category object
then? I think if you used the 'initial' argument in in the form
constructor it would work. Something like:

initial_data={'categories': [category.id]}
form = DocumentForm(request.POST, initial=initial_data, instance=new_doc)

Joseph

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Static files in development environment

2007-12-22 Thread pinco

Michael,

You are right: the Django admin was stepping on my media directory. I
changed the name of "media" directory to "my_media" and now everything
works fine.

Thank you very much for your help.


By the way, thank you also for your blog, which is an invaluable
source of learning for every django newbie like me.


On 22 Dic, 22:37, Empty <[EMAIL PROTECTED]> wrote:
> > I'm having some problems to serve static files in the development
> > environment.
>
> First, have you read 
> this:http://www.djangoproject.com/documentation/static_files/
>
> > The directory that actually contains the static files under OSX is:
>
> > /Users/paolo/Sites/SF06/sensationalfly/media/
>
> > I modified the settings.py MEDIA_ROOT parameter to:
>
> > MEDIA_ROOT = '/Users/paolo/Sites/SF06/sensationalfly/'
>
> > and MEDIA_URL to:
>
> > MEDIA_URL = '/'
>
> These really have nothing to do with it.
>
> > However, the following html tag doesn't'work (no image loaded):
>
> > 
>
> > Furtheremore, when I try the following URL:
>
> >http://127.0.0.1:8000/media/test_image.png
>
> > I receive this error message:
>
> > Page not found: /Library/Python/2.5/site-packages/django/contrib/admin/
> > media/test_image.png
>
> The Django admin is stepping on your media (sigh).  If you want to use
> /media/ as your location for your media, then you need to modify
> ADMIN_MEDIA_PREFIX to something else, like say /adminmedia/
>
> http://www.djangoproject.com/documentation/settings/#admin-media-prefix
>
> I assume you're using the built-in webserver (runserver) and if you
> are the static files link I gave you will help.  If you're trying to
> do this through apache then you just need to setup apache to serve
> your media and make sure you set the handler to none for that
> location.
>
> If you still are having problems, jump on IRC and we'll walk you through it.
>
> Michael Trier
> blog.michaeltrier.com
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Static files in development environment

2007-12-22 Thread Empty

> I'm having some problems to serve static files in the development
> environment.
>

First, have you read this:
http://www.djangoproject.com/documentation/static_files/

> The directory that actually contains the static files under OSX is:
>
> /Users/paolo/Sites/SF06/sensationalfly/media/
>
>
> I modified the settings.py MEDIA_ROOT parameter to:
>
> MEDIA_ROOT = '/Users/paolo/Sites/SF06/sensationalfly/'
>
> and MEDIA_URL to:
>
> MEDIA_URL = '/'
>

These really have nothing to do with it.

> However, the following html tag doesn't'work (no image loaded):
>
> 
>
>
> Furtheremore, when I try the following URL:
>
> http://127.0.0.1:8000/media/test_image.png
>
> I receive this error message:
>
> Page not found: /Library/Python/2.5/site-packages/django/contrib/admin/
> media/test_image.png
>

The Django admin is stepping on your media (sigh).  If you want to use
/media/ as your location for your media, then you need to modify
ADMIN_MEDIA_PREFIX to something else, like say /adminmedia/

http://www.djangoproject.com/documentation/settings/#admin-media-prefix

I assume you're using the built-in webserver (runserver) and if you
are the static files link I gave you will help.  If you're trying to
do this through apache then you just need to setup apache to serve
your media and make sure you set the handler to none for that
location.

If you still are having problems, jump on IRC and we'll walk you through it.


Michael Trier
blog.michaeltrier.com

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Extending pythonpath within python code

2007-12-22 Thread pk

os.path.normpath('e:/a/b/c') will give 'e:\\a\\b\\c'

On Dec 22, 6:50 am, Julien <[EMAIL PROTECTED]> wrote:
> Thanks for the tip!
>
> However, it's a bit strange because it only accepts paths with double
> back slashes, instead of the forward slashes required for declaring
> the template path for example.
>
> import sys
> sys.path.append('E:\\workspace\\myproject\\trunk\\apps')
> works
>
> but:
> import sys
> sys.path.append('E:/workspace/myproject/trunk/apps')
> doesn't work
>
> Is there a way around that? As I'm storing the absolute path of my
> project in a constant variable (with forward slashes), I'd like to do
> something like this:
>
> ABSOLUTE_PROJECT_PATH = 'E:/workspace/myproject/trunk/
> sys.append(ABSOLUTE_PROJECT_PATH + 'apps/')
>
> TEMPLATE_DIRS = (
> ABSOLUTE_PROJECT_PATH + 'templates/',
> )
>
> PS: As you may have guessed, I'm running under Windows.
>
> On Dec 22, 8:03 pm, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
>
> > On Sat, 2007-12-22 at 00:58 -0800, Julien wrote:
> > > Hi there,
>
> > > To keep my projects tidy, I'm used to having all my apps in a
> > > subfolder "apps".
> > > This means that I need to add that subfolder to the pythonpath. I can
> > > do this in apache or by doing runserver --pythonpath=apps.
>
> > > However, I'd like to extend the pythonpath within the code, for
> > > example in settings.py(*). That would save me from altering apache
> > > config files and would therefore make deployment a little easier.
>
> > > Is that possible, and is it recommended practice?
>
> > The python path lives in sys.path (which is a simple list). This means
> > that you can add new directories with sys.path.insert(0, 'your/path') or
> > sys.path.append('your/path'), whichever you like.
>
> > I do this all the time, mainly in the FastCGI caller script, but also in
> > settings.py to enable access to middleware classes and templatetags
> > which I use in nearly every project.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to initialize M2M field in new ModelForm?

2007-12-22 Thread Yatla

I need to initialize a selection in a M2M field of the Document
ModelForm during the first GET of a form that creates a new Document -
classes and view as follows:

class DocumentForm(forms.ModelForm):
class Meta:
model = Document

class Document(models.Model):
...
categories = models.ManyToManyField(Category)

view function:
def create(request, category_name, template='edit2.html', params={}):
category = get_object_or_404(Category, name=category_name)
new_doc = Document(author=request.user, pub_date=datetime.now())
if request.method == 'POST':
form = DocumentForm(request.POST, instance=new_doc)
if form.is_valid():
.
else:
form = DocumentForm(instance=new_doc)  # todo: figure out how
to initialize categories
params['form'] = form
return render_to_response(template, params,
RequestContext(request))

I've tried a few approaches without success.

TIA

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Static files in development environment

2007-12-22 Thread pinco

Hi,

I'm having some problems to serve static files in the development
environment.

The directory that actually contains the static files under OSX is:

/Users/paolo/Sites/SF06/sensationalfly/media/


I modified the settings.py MEDIA_ROOT parameter to:

MEDIA_ROOT = '/Users/paolo/Sites/SF06/sensationalfly/'

and MEDIA_URL to:

MEDIA_URL = '/'


However, the following html tag doesn't'work (no image loaded):




Furtheremore, when I try the following URL:

http://127.0.0.1:8000/media/test_image.png

I receive this error message:

Page not found: /Library/Python/2.5/site-packages/django/contrib/admin/
media/test_image.png



How can I fix this situation?

Thank you very much for any advice.


Paolo.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django documentation in chm (Dec 22, 2007)

2007-12-22 Thread pk

Thanks very much for doing this. While reading on djangoproject is
nice, sometimes it is faster/better to have a local version -- When I
am coding on a plane, for example !

P.K.

On Dec 22, 8:36 am, char101 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have created a chm format of the django docs taken from svn at Dec
> 22, 2007.
>
> Link:http://charupload.wordpress.com/2007/12/02/django-documentation-chm/
>
> Note: don't right click and save as on the links because it's a link
> to a page on divshare, not a direct link to the file.
>
> Cheers,
> Charles
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to make fields with editable=False visible in the Admin interface

2007-12-22 Thread Empty

> Well, not universally true. There are a lot of cases where this would,
> in fact, be useful information (e.g. last HTTP return code and message
> when editing an RSS feed entry for a planet syndication application, or
> the mail refusal code for a person's entry in newsletter software so you
> can judge whether to disable them). The main thing holding off
> implementing this is just waiting until newforms-admin is done (it's
> also not amazingly high priority).
>
> So this is a "one day" feature after newforms-admin is finished.

Glad to hear it Malcolm.  I know a lot of folks have a legitimate use
case for this, as you've described.

Michael Trier
blog.michaeltrier.com

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tutorial 2 admin Template not found

2007-12-22 Thread Empty

>
> So I've discovered that I can get the admin page to show up if I add '/
> System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> site-packages/django/contrib/admin/templates' to TEMPLATE_DIRS in the
> settings.py file for my project (for some reason this doesn't work in
> global_settings.py).

Looks almost like your TEMPLATE_LOADERS in settings.py doesn't have
the app loader enabled.  Check that.

> But admin shows up with no styling. Looks like my "MEDIA_ROOT" is
> wrong? I tried entering '/System/Library/Frameworks/Python.framework/
> Versions/2.5/lib/python2.5/site-packages/django/contrib/admin/media',
> but that doesn't work...and how am I to know the MEDIA_URL? Don't I
> have to map a URL or something? Is this stuff just not covered in the
> tutorial?

You need to set your ADMIN_MEDIA_PREFIX
(http://www.djangoproject.com/documentation/settings/#admin-media-prefix)
appropriately, as well as make sure it doesn't collide with your own
MEDIA_URL.

If you're using the built-in webserver (runserver) it will handle
mapping based on that ADMIN_MEDIA_PREFIX.

For serving your own static media, read though this:
http://www.djangoproject.com/documentation/static_files/

Michael Trier
blog.michaeltrier.com

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: KeyError in admin

2007-12-22 Thread Christian Schmidt

OK, i founf out, that I get these Error with every model where I have
a ManyToMany Field inside.
I have some other applications running on the server and there I have
the same problems in models with manytomany fields.

Is this a problem with python2.4?

christian.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django documentation in chm (Dec 22, 2007)

2007-12-22 Thread char101

Hi,

I have created a chm format of the django docs taken from svn at Dec
22, 2007.

Link: http://charupload.wordpress.com/2007/12/02/django-documentation-chm/

Note: don't right click and save as on the links because it's a link
to a page on divshare, not a direct link to the file.

Cheers,
Charles
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



KeyError in admin

2007-12-22 Thread Christian Schmidt

Hi,

I've a problem with the Django admininterface on my productive server.
If I want add an object with the admininterface I get following error
message:

KeyError at /admin/catalog/artikel/add/

Request Method: GET
Request URL:--MYSERVER--/admin/catalog/artikel/add/
Exception Type: KeyError
Exception Value:
Exception Location: /usr/lib/python2.4/site-packages/django/utils/
functional.py in __wrapper__, line 43
Template error

In template /usr/lib/python2.4/site-packages/django/contrib/admin/
templates/admin/field_line.html, error at line 4
Caught an exception while rendering: 
1   {% load admin_modify %}
2   
3   {% for bound_field in bound_fields %}
{{ bound_field.html_error_list }}{% endfor %}
4   {% for bound_field in bound_fields %}
5   {% if bound_field.has_label_first %}{% field_label bound_field %}{%
endif %}
6   {% field_widget bound_field %}
7   {% if not bound_field.has_label_first %}{% field_label bound_field
%}{% endif %}
8   {% if bound_field.field.help_text %}{{ bound_field.field.help_text }}{% endif %}
9   {% endfor %}
10  
11
Traceback (innermost last)
Switch to copy-and-paste view

* /usr/lib/python2.4/site-packages/django/template/__init__.py in
render_node
   741. result = node.render(context) ...
* /usr/lib/python2.4/site-packages/django/template/defaulttags.py
in render
   125. nodelist.append(node.render(context)) ...
* /usr/lib/python2.4/site-packages/django/template/defaulttags.py
in render
   211. if (value and not ifnot) or (ifnot and not value): ...
 * /usr/lib/python2.4/site-packages/django/utils/functional.py in
__wrapper__
43. return self.__dispatch[type(res)][funcname](res, *args,
**kw) ...


I only get this message on my productive server. It runs with
mod_python, postgresql 8.1 and Django SVN Revison 5335.
The same revision is on my local pc. But I use postgresql 8.2 and
djangos internal server. On my local pc I don't get any errors.

My model looks like the following:

class Marke(models.Model):
name = models.CharField(maxlength=100)
bild = models.ImageField(upload_to='marken/', height_field='hoehe',
width_field='breite', blank = True, null=True)

class Optionen(models.Model):
name= models.CharField(maxlength=100)

class Optionswert(models.Model):
name= models.CharField(maxlength=100, core=True)
option  = models.ForeignKey(Optionen, edit_inline=models.TABULAR,
num_in_admin=7, num_extra_on_change=4,)

class Rubrik(models.Model):
name= models.CharField(maxlength=100)
rubrik  = models.ForeignKey('self', blank=True, null=True,
related_name="Elternrubrik")
bild = models.ImageField(upload_to='rubrik/', height_field='hoehe',
width_field='breite', blank = True, null=True)

class Artikel(models.Model):
MWST = (
(7 , 'Ermäßigt' ),
(19, 'normal'),
)
art_name = models.CharField(maxlength=100)
kurztext = models.CharField(maxlength=500)
beschreibung = models.TextField()
preis   = models.FloatField()
mwst= models.IntegerField(choices=MWST)
optionen = models.ManyToManyField(Optionswert)
anzahl  = models.IntegerField(blank=True, null=True)
rubrik  = models.ForeignKey(Rubrik)
marke   = models.ForeignKey(Marke)

def __str__(self):
return self.art_name

class Admin:
list_display=('art_name', 'rubrik', 'marke', 'preis')
list_filter=['marke', 'rubrik']


I got a similar message when I try to change users with
django.contrib.auth and again only on the server.
Create or change objects without the admin works fine. So I think its
a problem with the admin. But I don't know why I only have these bug
on the server and not local.
The error message is in these case:

KeyError at /admin/auth/user/1/

Request Method: GET
Request URL:--MYSERVER--/admin/auth/user/1/
Exception Type: KeyError
Exception Value:
Exception Location: /usr/lib/python2.4/site-packages/django/utils/
functional.py in __wrapper__, line 43
Template error

In template /usr/lib/python2.4/site-packages/django/contrib/admin/
templates/admin/field_line.html, error at line 4

Ohh, i see that there is another different between server and my local
computer. I use python2.4 on serverside and 2.5 on my local
computer

Hope you can help me

Christian!


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to pass extra attributes to User authentication view?

2007-12-22 Thread shabda

To allow users to log-in,
I have something like this in urls.py

(r'^accounts/login/$', 'django.contrib.auth.views.login',
{'template_name': 'myapp/login.html'}),

But myapp/login.html expects a number of extra objects from that
populated by the login view. In other generic views, I could have
added extra objects by using extra_context optional method. But this
view does not take the extra_context optional argument., so how can I
pass extra objects to the template?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Extending pythonpath within python code

2007-12-22 Thread Julien

Thanks for the tip!

However, it's a bit strange because it only accepts paths with double
back slashes, instead of the forward slashes required for declaring
the template path for example.

import sys
sys.path.append('E:\\workspace\\myproject\\trunk\\apps')
works

but:
import sys
sys.path.append('E:/workspace/myproject/trunk/apps')
doesn't work

Is there a way around that? As I'm storing the absolute path of my
project in a constant variable (with forward slashes), I'd like to do
something like this:

ABSOLUTE_PROJECT_PATH = 'E:/workspace/myproject/trunk/
sys.append(ABSOLUTE_PROJECT_PATH + 'apps/')

TEMPLATE_DIRS = (
ABSOLUTE_PROJECT_PATH + 'templates/',
)


PS: As you may have guessed, I'm running under Windows.

On Dec 22, 8:03 pm, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
> On Sat, 2007-12-22 at 00:58 -0800, Julien wrote:
> > Hi there,
>
> > To keep my projects tidy, I'm used to having all my apps in a
> > subfolder "apps".
> > This means that I need to add that subfolder to the pythonpath. I can
> > do this in apache or by doing runserver --pythonpath=apps.
>
> > However, I'd like to extend the pythonpath within the code, for
> > example in settings.py(*). That would save me from altering apache
> > config files and would therefore make deployment a little easier.
>
> > Is that possible, and is it recommended practice?
>
> The python path lives in sys.path (which is a simple list). This means
> that you can add new directories with sys.path.insert(0, 'your/path') or
> sys.path.append('your/path'), whichever you like.
>
> I do this all the time, mainly in the FastCGI caller script, but also in
> settings.py to enable access to middleware classes and templatetags
> which I use in nearly every project.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Upstream caching and django

2007-12-22 Thread Winsley von Spee

On Fri, 21 Dec 2007 16:30:52 -0800 (PST)
JustJohnny <[EMAIL PROTECTED]> wrote:

> 
> Any community recommendations on types of upstream caching for django/
> dynamic sites? (besides the standard "the docs say")
> 
> Any pros/cons on a squid (http://www.squid-cache.org/) vs varnish
> (http://varnish.projects.linpro.no/)  setup?  Looking for solution to
> front 3-5 django application servers with psql backend and hit rates
> of 500,000 to 1,000,000 / hour.
> 
> Thanks for any ideas or remarks on your experience!

We are/will be using one squid per webserver that caches
static content (including javascript, css and user supplied files).
Expiration Date is set to several years and whenever something changes
we just increase the version number of the file [1]. Users cannot change
their files they have to reupload it so it gets a new id and a new
filename. Theoretically you wouldn't even need a squid for static
content like that cause the content should be cached in the browsers
cache but you don't want users that use a very small cache to hit the
application servers all the time.

The actual pages are cached within django cause at least a small
fraction of each page is always generated dynamically.

Works like a charm, althought I haven't looked at varnish yet, perhaps I
should.


[1] http://developer.yahoo.com/performance/rules.html#expires

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm with Image/FileField not working

2007-12-22 Thread Kenneth Gonsalves


On 22-Dec-07, at 3:38 PM, Malcolm Tredinnick wrote:

> Here's the problem.. I should have spotted  it the first time. You  
> need
> to pass in any files as the second argument to the form.
>
> newpage = Ph(request.POST, request.FILES)
>
> So the form is complaining about something valid: you weren't  
> giving it
> the file data. I think you'll find that everything should work once  
> you
> change this.

yes - I also had to add the enctype="multipart/form-data" thingie in  
the template. Thanks again for your patience, but I feel the  
ModelForm documentation needs more details.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Getting Error - "Error while importing URLconf 'blogango.urls': list index out of range"

2007-12-22 Thread Malcolm Tredinnick


On Sat, 2007-12-22 at 00:53 -0800, shabda wrote:
> Ok I found the error, but I still cant understand why this is
> happening. What I did was that, in the blogango.urls, I have a line
> like
> 
> import feeds
> 
> THe feeds.py is,
> 
> class main_feed (Feed):
> blog = Blog.objects.all()[0]

This doesn't look great. This line will be executed once (exactly once
and only once) when the feeds.py file is imported. Which means it isn't
really very dynamic. That's why you're seeing the error in urls.py, as
well: you no doubt import feeds in blogango/urls.py and that causes the
class to be parsed, which executes lines like this.

> title = blog.title
> link = "/rss/latest/"
> description = blog.tag_line

Title and description can both be methods, so the more robust way to
write what you're trying to do is something like:

def title(self):
   try:
  b = Blog.objects.all()[0]
   except IndexError:
  return "something for the empty case"
   return b.title

and similar for description. Maybe factor out the bit that gets the Blog
object and even store it in an attribute after the first time to avoid
repeated lookups.

The general thing about the syndication framework is that most of these
attributes can either be a straight constant value (title = "foo"), a
method that takes only "self" (def title(self):...) or a method that
takes self and the current object (def title(self, obj): ...). Have a
read of
http://www.djangoproject.com/documentation/syndication_feeds/#feed-class-reference
 to see the possibilities.

Regards,
Malcolm

-- 
Telepath required. You know where to apply... 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm with Image/FileField not working

2007-12-22 Thread Malcolm Tredinnick


On Sat, 2007-12-22 at 15:33 +0530, Kenneth Gonsalves wrote:
> 
> On 22-Dec-07, at 1:16 PM, Malcolm Tredinnick wrote:
[...]
> > You should always be checking is_valid() before trying to save to  
> > avoid
> > this type of problem. Since, newpage.is_valid() will be false here,  
> > you
> > can print out the errors and see what's going wrong.
> 
> checked that - am getting an error list - 'photo' 'this field is  
> required'. Which silly because the field is filled in. I tried  
> ModelForms with other field types, and find the same error comes when  
> a required field is not filled in. Even running is_valid is of no  
> help, because, unlike in new forms, a negative value for is_valid  
> does not return the form with errors as it should.

Hold on, there's some confusion going on here. Firstly, ModelForms *is*
part of newforms. It uses standard newforms practices. Calling
is_valid() on a form class returns False if and only if you've either
forgotten to supply data or self.errors is not empty. So is_valid() is
intimately tied to self.errors.

>  Anyway, I changed  
> the code like this:
> 
> def addph(request):
>  if request.POST:
>  newpage =Ph(request.POST)

Here's the problem.. I should have spotted  it the first time. You need
to pass in any files as the second argument to the form.

newpage = Ph(request.POST, request.FILES)

So the form is complaining about something valid: you weren't giving it
the file data. I think you'll find that everything should work once you
change this.

Regards,
Malcolm

-- 
Everything is _not_ based on faith... take my word for it. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm with Image/FileField not working

2007-12-22 Thread Kenneth Gonsalves


On 22-Dec-07, at 1:16 PM, Malcolm Tredinnick wrote:

> On Sat, 2007-12-22 at 13:00 +0530, Kenneth Gonsalves wrote:
>> hi,
>> am using the latest svn head, and trying to get ModelForm working
>> with Image/FileField. The model is here:
>>
>> class Photo(models.Model):
>>  """Photo plus blurb - blurb to be translated but optional
>>  """
>>  photo=models.ImageField(_("Picture"),upload_to='images/pics')
>>  page = models.ForeignKey(Page,verbose_name=_("Page"))
>>  matter = models.CharField(_("Caption for photo"),max_length=80,
>>  blank=True,null=True)
>>  rank = models.IntegerField(_("Rank in page"),default = 1)
>>
>> and the ModelForm is here:
>>
>> class Ph(ModelForm):
>>  class Meta:
>>  model = Photo
>> def addph(request):
>>  if request.POST:
>>  newpage =Ph(request.POST)
>>  f=newpage.save()
>>  return HttpResponseRedirect('/web/addph/' )
>>  else:
>>  form = Ph()
>>  t = loader.get_template('web/addbrick.html')
>>  c = Context(
>>  {
>>   'request':request,
>>   'form': form,
>>   })
>>  return HttpResponse(t.render(c))
>>
>> I get the error: 'The Photo could not be created because the data did
>> not validate'. It saves fine from admin.
>
> You should always be checking is_valid() before trying to save to  
> avoid
> this type of problem. Since, newpage.is_valid() will be false here,  
> you
> can print out the errors and see what's going wrong.

checked that - am getting an error list - 'photo' 'this field is  
required'. Which silly because the field is filled in. I tried  
ModelForms with other field types, and find the same error comes when  
a required field is not filled in. Even running is_valid is of no  
help, because, unlike in new forms, a negative value for is_valid  
does not return the form with errors as it should. Anyway, I changed  
the code like this:

def addph(request):
 if request.POST:
 newpage =Ph(request.POST)
 if newpage.is_valid():
 f=newpage.save()
 return HttpResponseRedirect('/web/showarticle/3/' )
 else:
 form = newpage
 else:
 form = Ph()
 t = loader.get_template('web/addbrick.html')
 c = Context(
 {
  'request':request,
  'form': form,
  })
 return HttpResponse(t.render(c))

I now get a big red field required error message next to the  
imageupload widget, and the said widget is empty - in other words, my  
file did not go to request.POST. So it must be in request.FILES?



-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tutorial 2 admin Template not found

2007-12-22 Thread Jeff Anderson
I have no problems going through the tutorial (and creating my own apps)
on my mac. Are you using the development server to do all of this? I
could see where you'd have the problems you are having if you are trying
this all through apache/mod_python.
How did you install django? from source? I don't know if there is a
darwinports or a fink package out there. The way I installed django on
my mac (running leopard) was like this:

cd /Library/Python/2.5/site-packages
sudo |svn co http://code.djangoproject.com/svn/django/trunk/django django

I never had to do anything like manually configure the admin TEMPLATE_DIRS.
I am using the development version, and I haven't been around long
enough to know for sure, but you may be experiencing a bug related to
django-0.96/mac.

You do need to map a URL for the admin media url in a production
server--like apache. On my production server, I haven't bothered to get
it working, so my admin interface is very boring and plain looking, but
I don't really use it anyway. On the django built-in development server
it should just work.

Good Luck!

Jeff Anderson
|
kadavy wrote:
> So I've discovered that I can get the admin page to show up if I add '/
> System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> site-packages/django/contrib/admin/templates' to TEMPLATE_DIRS in the
> settings.py file for my project (for some reason this doesn't work in
> global_settings.py).
>
> But admin shows up with no styling. Looks like my "MEDIA_ROOT" is
> wrong? I tried entering '/System/Library/Frameworks/Python.framework/
> Versions/2.5/lib/python2.5/site-packages/django/contrib/admin/media',
> but that doesn't work...and how am I to know the MEDIA_URL? Don't I
> have to map a URL or something? Is this stuff just not covered in the
> tutorial?
>
> Clearly I'm confused and have lots of questions - hopefully someone
> can help me make sense of at least one or two of them.
>
> Thanks so much for your help.
> --~--~-~--~~~---~--~~
> 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 [EMAIL PROTECTED]
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en
> -~--~~~~--~~--~--~---
>
>   




signature.asc
Description: OpenPGP digital signature


Re: Tutorial 2 admin Template not found

2007-12-22 Thread kadavy

So I've discovered that I can get the admin page to show up if I add '/
System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/contrib/admin/templates' to TEMPLATE_DIRS in the
settings.py file for my project (for some reason this doesn't work in
global_settings.py).

But admin shows up with no styling. Looks like my "MEDIA_ROOT" is
wrong? I tried entering '/System/Library/Frameworks/Python.framework/
Versions/2.5/lib/python2.5/site-packages/django/contrib/admin/media',
but that doesn't work...and how am I to know the MEDIA_URL? Don't I
have to map a URL or something? Is this stuff just not covered in the
tutorial?

Clearly I'm confused and have lots of questions - hopefully someone
can help me make sense of at least one or two of them.

Thanks so much for your help.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Extending pythonpath within python code

2007-12-22 Thread Matthias Kestenholz

On Sat, 2007-12-22 at 00:58 -0800, Julien wrote:
> Hi there,
> 
> To keep my projects tidy, I'm used to having all my apps in a
> subfolder "apps".
> This means that I need to add that subfolder to the pythonpath. I can
> do this in apache or by doing runserver --pythonpath=apps.
> 
> However, I'd like to extend the pythonpath within the code, for
> example in settings.py(*). That would save me from altering apache
> config files and would therefore make deployment a little easier.
> 
> Is that possible, and is it recommended practice?

The python path lives in sys.path (which is a simple list). This means
that you can add new directories with sys.path.insert(0, 'your/path') or
sys.path.append('your/path'), whichever you like.

I do this all the time, mainly in the FastCGI caller script, but also in
settings.py to enable access to middleware classes and templatetags
which I use in nearly every project.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Extending pythonpath within python code

2007-12-22 Thread Julien

Hi there,

To keep my projects tidy, I'm used to having all my apps in a
subfolder "apps".
This means that I need to add that subfolder to the pythonpath. I can
do this in apache or by doing runserver --pythonpath=apps.

However, I'd like to extend the pythonpath within the code, for
example in settings.py(*). That would save me from altering apache
config files and would therefore make deployment a little easier.

Is that possible, and is it recommended practice?

Cheers!

Julien

(*) Maybe something like this:
PYTHON_PATH += 'apps/'
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Getting Error - "Error while importing URLconf 'blogango.urls': list index out of range"

2007-12-22 Thread shabda

Ok I found the error, but I still cant understand why this is
happening. What I did was that, in the blogango.urls, I have a line
like

import feeds

THe feeds.py is,

class main_feed (Feed):
blog = Blog.objects.all()[0]
title = blog.title
link = "/rss/latest/"
description = blog.tag_line
def items (self):
   entries = BlogEntry.objects.all()[:10]
   return entries

If I navigate to any page after I have just run manage.py reset ...,
there is no Blog object and Blog.objects.all()[0] raises exception. If
I change feeds.py to something like,


class main_feed (Feed):
try:
   blog = Blog.objects.all()[0]
except:
   class DummyBlog:
   def __init__ (self):
 self.title = ''
 self.tag_line = ''
   blog = DummyBlog()
title = blog.title
link = "/rss/latest/"
description = blog.tag_line
def items (self):
   entries = BlogEntry.objects.all()[:10]
   return entries

I get no error. What I do not understand is why should the main_feed
class be instantiated as soon as I import feeds? Should not the
instantiation happen only when the feed is accesed?

On Dec 22, 1:26 pm, shabda <[EMAIL PROTECTED]> wrote:
> Getting this error, "Error while importing URLconf 'blogango.urls':
> list index out of range". The exception stack does not give any cles
> to what might be wrong. The exception stack is,
> Traceback:
> File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in
> get_response
>   73. callback, callback_args, callback_kwargs =
> resolver.resolve(request.path)
> File "C:\Python24\lib\site-packages\django\core\urlresolvers.py" in
> resolve
>   233. sub_match = pattern.resolve(new_path)
> File "C:\Python24\lib\site-packages\django\core\urlresolvers.py" in
> resolve
>   231. for pattern in self.urlconf_module.urlpatterns:
> File "C:\Python24\lib\site-packages\django\core\urlresolvers.py" in
> _get_urlconf_module
>   255. raise ImproperlyConfigured, "Error while
> importing URLconf %r: %s" % (self.urlconf_name, e)
>
> Exception Type: ImproperlyConfigured at /
> Exception Value: Error while importing URLconf 'blogango.urls': list
> index out of range
>
> The urls.py is,
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns('',
> # Example:
> # (r'^foo/', include('foo.foo.urls')),
>
> # Uncomment this for admin:
> #(r'^admin/', include('django.contrib.admin.urls')),
> (r'^', include('blogango.urls')),
> )
>
> Any clues why this is happening?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Getting Error - "Error while importing URLconf 'blogango.urls': list index out of range"

2007-12-22 Thread shabda

Getting this error, "Error while importing URLconf 'blogango.urls':
list index out of range". The exception stack does not give any cles
to what might be wrong. The exception stack is,
Traceback:
File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in
get_response
  73. callback, callback_args, callback_kwargs =
resolver.resolve(request.path)
File "C:\Python24\lib\site-packages\django\core\urlresolvers.py" in
resolve
  233. sub_match = pattern.resolve(new_path)
File "C:\Python24\lib\site-packages\django\core\urlresolvers.py" in
resolve
  231. for pattern in self.urlconf_module.urlpatterns:
File "C:\Python24\lib\site-packages\django\core\urlresolvers.py" in
_get_urlconf_module
  255. raise ImproperlyConfigured, "Error while
importing URLconf %r: %s" % (self.urlconf_name, e)

Exception Type: ImproperlyConfigured at /
Exception Value: Error while importing URLconf 'blogango.urls': list
index out of range

The urls.py is,
from django.conf.urls.defaults import *

urlpatterns = patterns('',
# Example:
# (r'^foo/', include('foo.foo.urls')),

# Uncomment this for admin:
#(r'^admin/', include('django.contrib.admin.urls')),
(r'^', include('blogango.urls')),
)

Any clues why this is happening?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: "url" template function problem

2007-12-22 Thread Christos Τrochalakis

On 12/22/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> On Wed, 2007-12-19 at 08:15 -0800, Trochalakis Christos wrote:
> > Hello there,
> >
> > I'm trying to use the "url" template function but i cant make it work.
> >
> > My attempt:
> >
> > urls.py:
> >
> > urlpatterns = patterns('',
> > url(r'^tag/(?P[^/]+(?u))/$',
> > tagged_object_list,
> > dict(model=Entry, paginate_by=10, allow_empty=True,
> > template_object_name='entry'),
> > name="tag_index"),
> > )
> >
> > my template:
> >
> > {% url tag_index tag=django %}
> >
> > Django version: 0.97-pre-SVN-6920
> > Exception:
> >
> > Request Method:   GET
> > Request URL:  http://localhost:8080/
> > Exception Type:   error
> > Exception Value:  unknown extension
> [...]
> In this case, though, you're lucky; I recognise the error. The
> reverse-parsing of the reg-exps in URL patterns doesn't handle every
> possible feature of Python's reg-exp engine. You're using smoething it
> doesn't handle (quite probably the (?u) flag). Fortunately, you can just
> drop the "?u" bit, since all URL patterns are matched with the
> re.UNICODE flag enabled.

Works like a charm now! Thanks Malcom.

I got the regex from the tagging app documentation, so I also filled a
bug there.

http://code.google.com/p/django-tagging/issues/detail?id=82

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---