Re: newforms confirmation page, displaying input data

2007-12-05 Thread James Bennett

On Dec 6, 2007 1:13 AM, wideback <[EMAIL PROTECTED]> wrote:
> I am trying to display the data input using a newform on a new page
> after it is verified. I am looking at  the 'Complex template output'
> code given in the newforms documentation. However I do not want to
> display the input field with data (what '{{ field }}') displays but
> rather just the data. Does anyone know how I might accomplish this?

http://www.djangoproject.com/documentation/form_preview/

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



newforms confirmation page, displaying input data

2007-12-05 Thread wideback

I am trying to display the data input using a newform on a new page
after it is verified. I am looking at  the 'Complex template output'
code given in the newforms documentation. However I do not want to
display the input field with data (what '{{ field }}') displays but
rather just the data. Does anyone know how I might accomplish this?

Here is a sample of the code I am using:



{% for field in form %}
{{ field.label_tag }}
{{ field }} {# replace field with something that only
displays the field data #}
{% if field.help_text %}{{ field.help_text }}{% endif %}
{% if field.errors %}{{ field.errors }}{% endif %}
{% endfor %}



--~--~-~--~~~---~--~~
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: "Between" bug when using SQLite?

2007-12-05 Thread James Bennett

On Dec 5, 2007 9:56 PM, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> I opened:
>
> http://code.djangoproject.com/ticket/6141

I didn't see this until just now, but it's actually an issue that's
already been reported. I've closed your ticket as a duplicate, with a
pointer to the original report (and I believe this is already or will
be fixed in queryset-refactor).


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: Is there a better way to do this with the DB API?

2007-12-05 Thread globophobe

On Dec 6, 10:29 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2007-12-05 at 15:34 -0800, globophobe wrote:
> Probably an easier question to answer if we could see the models
> involved (and perhaps an English description of what you are wanting to
> achieve). My gut feeling is that this is either as simple as you get or
> else it should be possible to fold the exclude directly into the "cards"
> queryset without having to do an explicit extra query. Which alternative
> is possible depends on your model relationships.
>
> Regards,
> Malcolm

Good point.

class Stack(models.Model):
title = models.CharField(max_length=100)
description = models.TextField()

def __unicode__(self):
return self.title

class Card(models.Model):
stack = models.ForeignKey(Stack)
front = models.TextField(core=True)
back = models.TextField(core=True)

class Meta:
ordering = ['id']

def __unicode__(self):
return self.id

class Study(models.Model):
user = models.ForeignKey(User)
stack = models.ForeignKey(Stack)
card = models.ForeignKey(Card)
total_correct = models.IntegerField()
total_incorrect = models.IntegerField()
average_correct = models.FloatField()

def __unicode__(self):
return self.id

Basically, the Study model is a record of a users study history for a
card. It doesn't have a ForeignKey to a stack as I only want rows to
be inserted after a study session i.e. I don't want to create a record
for each card for each user, even if it may be necessary eventually,
because the number of records in Study could quickly amount to the
tens or hundreds of thousands.

A session has 20 or so cards which are sourced first from the Study
model and then from cards in the Stack that are not yet contained in
the Study model per user in question.
--~--~-~--~~~---~--~~
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: "Between" bug when using SQLite?

2007-12-05 Thread Doug Van Horn

On Dec 5, 8:29 pm, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> On Dec 5, 5:31 pm, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> [snip snip snip]

I opened:

http://code.djangoproject.com/ticket/6141

and added some patches.  Hopefully it'll get looked at and accepted.

doug.
--~--~-~--~~~---~--~~
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: Combating submission form Spam

2007-12-05 Thread James Bennett

On Dec 5, 2007 6:50 PM, Darryl Ross <[EMAIL PROTECTED]> wrote:
> One of the websites I run has started getting spam via the contact form.
>
> What is the recommended way of dealing with this? Do I need to go the
> route of using something like django-captcha?

Shameless plug: my contact-form application[1] includes a form class
which runs an Akismet spam check and raises a validation error on
suspected spam.

[1] http://code.google.com/p/django-contact-form/


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 Book

2007-12-05 Thread James Bennett

On Dec 5, 2007 8:41 PM, etank <[EMAIL PROTECTED]> wrote:
> Is the code for the http://www.djangobook.com/en/beta/ available
> anywhere for download? I am wanting to write some documentation for
> Foresight Linux and I like the way that this site works. Any help that
> you provide would be great.

This has been asked and answered several times. Please consider
searching the public archive of this list for more information.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 Book

2007-12-05 Thread etank

Is the code for the http://www.djangobook.com/en/beta/ available
anywhere for download? I am wanting to write some documentation for
Foresight Linux and I like the way that this site works. Any help that
you provide would be great.
--~--~-~--~~~---~--~~
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: Strange FastCGI problems

2007-12-05 Thread Graham Dumpleton

On Dec 6, 12:40 pm, TP <[EMAIL PROTECTED]> wrote:
> I thought I needed multiple Apache's since I frequently have several
> concurrent requests. The actual dynamic python processing is quick,
> but since clients could be connected for relatively long (slow
> connections, etc), I thought I'd need multiple Apache's talking to
> each. Since Django says it's not officially thread safe, I'm using the
> prefork MPM in Apache.

Even in 'prefork' mode of Apache, there are multiple processes
handling requests and so concurrent requests is not a problem. The
problem with prefork though is that you can end up with lots of
process, all consuming the maximum your Django application will use.

For memory constrained VPS systems, using 'worker' MPM is a better
choice as you cut down on the number of Apache child processes and
therefore memory, with concurrency then coming from multithreading,
but also from fact that multiple processes still may also be running.

You might have a read of:

  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

which talks about the different process/threading models that Apache
provides and how mod_wsgi makes use of them and extends on them.

In respective of thread safety of Django, where does it say it is 'not
officially thread safe'. I know that it is implied through fact they
suggest prefork when using mod_python, but they also don't say to
avoid mod_python on Windows, which is multithread, plus FASTCGI
examples give examples using multithreading. So, there is actually
conflicting information on the issue.

As explained in:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

the situation seems to be that there are no known current issues with
Django itself in respect of multithreading. Thus, any multithread
problems are more likely to come from the application built by a user
using Django. So, it is just a matter of testing your application so
you are satisfied that there isn't a problem.

> I looked at mod_wsgi and decided to try fastcgi since the Django docs
> explicitly support it. But, given my problems perhaps I'll try
> mod_wsgi next.

That there is nothing in Django documentation about mod_wsgi is more
to do with no one offering up anything to add which mentions it. The
Django documentation on mod_wsgi site is reasonably comprehensive and
maybe even a link to that would be a good start. I haven't offered
anything up myself for the Django site as believe that it has to be
the Django developers/community that first need to work out whether
they see it as a viable option and when they are happy add a link to
it.

FWIW, people are using mod_wsgi quite happily with Django. I know of a
couple of notable Django sites which are delaying looking at moving
until mod_wsgi 2.0 is released as that will be the first version which
allows Python code to be used to implement Apache HTTP authentication
provider. For what those sites do, having that feature is critical and
they can't move away from mod_python until mod_wsgi provides an
equivalent mechanism.

Graham

> On Dec 5, 8:26 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Dec 6, 12:04 pm, TP <[EMAIL PROTECTED]> wrote:
>
> > > I've been using Django for the past few months and had great results
> > > with Apache and mod_python. However, I'd like to try and reduce the
> > > amount of memory that is used by having multiple Apache's each with
> > > their own copy of my application. I decided to try mod_fastcgi in
> > > Apache and Django's FastCGI server capability.
>
> > Why have multiple Apache's if using mod_fastcgi. You should be able to
> > hang multiple FASTCGI hosted applications hanging off the one Apache.
>
> > BTW, you might also want to look at mod_wsgi. Allows you to run Django
> > in separate process of their own just like FASTCGI, but everything
> > still managed by Apache without the need for you to separately start
> > Django or use any supervisor system to keep it running.
>
> > Graham
--~--~-~--~~~---~--~~
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: "Between" bug when using SQLite?

2007-12-05 Thread Doug Van Horn

On Dec 5, 5:31 pm, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> I'm running into a funny issue when testing with SQLite3 (Python 2.5).
>
> I have a model with the following (simplified):
>
> class Event(models.Model):
> event_title = models.CharField()
> event_from_date = models.DateField()
>
> I create an event on 2008-01-01 (January 1st) and on 2008-01-02
> (January 2nd).
>
> I run the following in the shell:
>
> In [10]: Event.objects.filter(event_from_date__year=2008)
> Out[10]: []
>
> In [11]: Event.objects.filter(event_from_date__month=1)
> Out[11]: [, ]
>
> In [12]: Event.objects.filter(event_from_date__year=2008,
> event_from_date__month=1)
> Out[12]: []
>
> Here are the queries (I edited out a bunch of other fields from the
> select clause, but nothing from the where clause, so they're not
> exactly as output from django):
>
> In [18]: connection.queries
> Out[18]:
> [{'sql': u'SELECT
> "app_event"."id","app_event"."event_from_date","app_event"."title"
> FROM "app_event" WHERE ("app_event"."event_from_date" BETWEEN
> 2008-01-01 00:00:00 AND 2008-12-31 23:59:59.99) ORDER BY
> "app_event"."event_from_date" ASC, "app_event"."title" ASC',
>   'time': '0.001'},
>  {'sql': u'SELECT
> "app_event"."id","app_event"."event_from_date","app_event"."title"
> FROM "app_event" WHERE (django_extract("month",
> "app_event"."event_from_date") = 1) ORDER BY
> "app_event"."event_from_date" ASC, "app_event"."title" ASC',
>   'time': '0.001'},
>  {'sql': u'SELECT
> "app_event"."id","app_event"."event_from_date","app_event"."title"
> FROM "app_event" WHERE (django_extract("month",
> "app_event"."event_from_date") = 1 AND "app_event"."event_from_date"
> BETWEEN 2008-01-01 00:00:00 AND 2008-12-31 23:59:59.99) ORDER BY
> "app_event"."event_from_date" ASC, "app_event"."title" ASC',
>   'time': '0.001'}]
>
> Could it be that the 'year' predicate is missing the 'django_extract'
> function?
>
> Thanks for any help...
>
> Doug Van Horn

I'm going to follow up on my own post with some additional
information.

In db.models.query.get_where_clause, the __year lookup type is treated
like a range using 'between':

elif lookup_type in ('range', 'year'): # could remove 'year' from
here.
return '%s BETWEEN %%s AND %%s' % field_sql

Whereas __month and __day use sql functions to extract the relevant
column:

elif lookup_type in ('month', 'day'): # could add 'year' here.
return "%s = %%s" %
connection.ops.date_extract_sql(lookup_type, field_sql)


The %%s portion of those strings are filled in by
db.models.fields.Field.get_db_prep_lookup(self, lookup_type, value).
__year lookups return the following:

elif lookup_type == 'year':
try:
value = int(value)
except ValueError:
raise ValueError("The __year lookup type requires an
integer argument")
return ['%s-01-01 00:00:00' % value, '%s-12-31
23:59:59.99' % value]
#return ['%s' % value] # could treat year as a single
value.

This matches the between clause we saw earlier.


__month and __day return:

if lookup_type in ('exact', 'regex', 'iregex', 'gt', 'gte',
'lt', 'lte', 'month', 'day', 'search'):
return [value]

This matches the extract function we saw earlier.


So understanding how all this works, my question is why are __year
lookups treated this way?

I changed the django code to treat __year the same as __month and
__day (as commented above) and fixed the issue of the first day of
January being missing from the event_from_date__year=2008 query I
referenced in my first post, so it's at least functional this way (not
necessarily correct).

I'm sure I'm missing something, so if someone knows why __year queries
are treated as betweens rather than sql function extractions I'd like
to know.  :-)


Regards,

Doug Van Horn
--~--~-~--~~~---~--~~
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: Strange FastCGI problems

2007-12-05 Thread TP

I thought I needed multiple Apache's since I frequently have several
concurrent requests. The actual dynamic python processing is quick,
but since clients could be connected for relatively long (slow
connections, etc), I thought I'd need multiple Apache's talking to
each. Since Django says it's not officially thread safe, I'm using the
prefork MPM in Apache.

I looked at mod_wsgi and decided to try fastcgi since the Django docs
explicitly support it. But, given my problems perhaps I'll try
mod_wsgi next.


On Dec 5, 8:26 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Dec 6, 12:04 pm, TP <[EMAIL PROTECTED]> wrote:
>
> > I've been using Django for the past few months and had great results
> > with Apache and mod_python. However, I'd like to try and reduce the
> > amount of memory that is used by having multiple Apache's each with
> > their own copy of my application. I decided to try mod_fastcgi in
> > Apache and Django's FastCGI server capability.
>
> Why have multiple Apache's if using mod_fastcgi. You should be able to
> hang multiple FASTCGI hosted applications hanging off the one Apache.
>
> BTW, you might also want to look at mod_wsgi. Allows you to run Django
> in separate process of their own just like FASTCGI, but everything
> still managed by Apache without the need for you to separately start
> Django or use any supervisor system to keep it running.
>
> Graham
--~--~-~--~~~---~--~~
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: Combating submission form Spam

2007-12-05 Thread Darryl Ross
John Lenton wrote:
> recaptcha:
> http://recaptcha.net/

Looks like an interesting project, I will check it out. Thanks.

Regards
Darryl



signature.asc
Description: OpenPGP digital signature


Re: Is there a better way to do this with the DB API?

2007-12-05 Thread Malcolm Tredinnick


On Wed, 2007-12-05 at 15:34 -0800, globophobe wrote:
> I've read the documentation. I admit to being more than a little
> deficient with databases. Can anybody suggest a better way?
> 
> if len(study) < 20:
> exclude = user.study_set.filter(stack=stack).values('card')
> cards = stack.card_set.exclude(id__in=[i.get('card') for i in
> exclude])[:20-len(study)]

Probably an easier question to answer if we could see the models
involved (and perhaps an English description of what you are wanting to
achieve). My gut feeling is that this is either as simple as you get or
else it should be possible to fold the exclude directly into the "cards"
queryset without having to do an explicit extra query. Which alternative
is possible depends on your model relationships.

Regards,
Malcolm

-- 
Quantum mechanics: the dreams stuff is made of. 
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: Strange FastCGI problems

2007-12-05 Thread Graham Dumpleton

On Dec 6, 12:04 pm, TP <[EMAIL PROTECTED]> wrote:
> I've been using Django for the past few months and had great results
> with Apache and mod_python. However, I'd like to try and reduce the
> amount of memory that is used by having multiple Apache's each with
> their own copy of my application. I decided to try mod_fastcgi in
> Apache and Django's FastCGI server capability.

Why have multiple Apache's if using mod_fastcgi. You should be able to
hang multiple FASTCGI hosted applications hanging off the one Apache.

BTW, you might also want to look at mod_wsgi. Allows you to run Django
in separate process of their own just like FASTCGI, but everything
still managed by Apache without the need for you to separately start
Django or use any supervisor system to keep it running.

Graham
--~--~-~--~~~---~--~~
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: Installation - symlink vs. python setup.py install

2007-12-05 Thread Graham Dumpleton

On 10.5 with a virgin Python 2.5 installation there is no:

/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages

If you have it then something has wrongly created it and you probably
should delete the whole directory in case it causes problems.

The Python 2.3 installation on 10.5 still has the site-packages in the
long path location, but as I said, it is a symlink to /Library/Python/
2.3/...

BTW, with all the problems you are having, you might want to look at
mod_wsgi 2.0 instead and use its support for easily pointing at Python
virtual environments created using virtualenv. This way you could have
different virtual environments for different versions of Django and
how applications using the different versions in different daemon
processes using mod_wsgi daemon mode. :-)

Graham

On Dec 6, 11:14 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> Okay, I had a part brain fade there. Was confusing /Library/Frameworks/
> Python with /Library/Python. The /Library/Frameworks/Python is what
> MacPorts uses.
>
> Also looks like Python 2.5 on Mac OS X 10.5 sets up sys.path
> differently, ie., uses shorter /Library/Python/2.5/sites-packages
> instead of longer path out of /System/Library/Frameworks/Python.
>
> On Mac OS X 10.4 and Python 2.3 the long path version is just a
> symlink to the short path version.
>
>  8 lrwxr-xr-x 1 root  wheel  56 Jul 13  2006 site-packages -
>
> > ../../../../../../../../Library/Python/2.3/site-packages
>
> Ie., they should effectively be the same directory, yet your comment
> about partial Django in long path suggests they aren't, or what you
> are symlinking to with the django link isn't correct in the first
> place.
>
> I have 10.5 on a firewire drive here so I'll try and boot it up and
> see how it links the two directories if it does.
>
> Graham
>
> On Dec 6, 11:01 am, Greig Rapley <[EMAIL PROTECTED]> wrote:
>
> > $ sudo port installed
>
> > does not include python in the list returned, so I assume I am using
> > the OS version.
>
> > $ which python
> > /usr/bin/python
>
> > and,
>
> > $ python -c "from distutils.sysconfig import get_python_lib; print
> > get_python_lib()"
> > /Library/Python/2.5/site-packages
>
> > I have been symlinking into /Library/Python/2.5/site-packages.
>
> > I have found the *other* site-packages directory, it is;
>
> > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > site-packages
>
> > but there is only a partial django directory in there;
>
> > django/conf
> > django/contrib
>
> > Ok, so I have removed MacPorts following the instructions in the FAQ.
>
> > I have installed the testhandler and here are the results;
>
> > General information
>
> > Apache version  Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.7l DAV/2
> > mod_python/3.3.1 Python/2.5.1
> > Apache threaded MPM No (single thread MPM)
> > Apache forked MPM   Yes, maximum 256 processes
> > Apache server root  /usr
> > Apache document root/Library/WebServer/Documents
> > Apache error log/private/var/log/apache2/error_log (view last 100
> > lines)
> > Python sys.version  2.5.1 (r251:54863, Oct 5 2007, 21:08:09) [GCC 4.0.1
> > (Apple Inc. build 5465)]
> > Python sys.path
> > /Library/Python/2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.5-
> > i386.egg
> > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > python25.zip
> > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
> > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > plat-darwin
> > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > plat-mac
> > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > plat-mac/lib-scriptpackages
> > /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/
> > python
> > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > lib-tk
> > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > lib-dynload
> > /Library/Python/2.5/site-packages
> > /Library/Python/2.5/site-packages/PIL
> > /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/
> > python/PyObjC
> > Python interpreter name main_interpreter
> > mod_python.publisher available  Yes
> > mod_python.psp availableNo
>
> > which still works without MacPorts.
>
> > And;
>
> > $ python
> > Python 2.5.1 (r251:54863, Oct  5 2007, 21:08:09)
> > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.
>
> > >>> import django.core.handlers.modpython
>
> > Looks like the same Python from the command line as from within
> > mod_python, and yet the command line interpreter has no problem
> > finding django.core.handlers.modpython !
>
> > Still hoping I can find a way to symlink instead of installing every
> > svn update :-)
>
> > On Dec 5, 1:13 am, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > BTW, that it is

Re: Unhandled Exception on new server (Lighttpd + FastCGI)

2007-12-05 Thread Derek Payton

Karen,

The ticket says, "If flatpages and DEBUG=False and 404.html doesn't
exist it throws the error".

I have DEBUG=True, and I'm getting an "Unhandled Exception" error, not
the default yellow "Django 404 Error with DEBUG=True"

Anyways, the issue now seems to be with the way flatpages handles
500's. Not sure if it's a bug nor not.

--Derek

On Dec 5, 4:42 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On 12/5/07, Derek Payton <[EMAIL PROTECTED]> wrote:
>
>
>
> > Apparently there was an issue with my svn. I downgraded to a previous
> > revision (pre-6778), then back to trunk. Everything is working now,
> > except flatpages. Here's the error from lighttpd's log:
> >http://dpaste.com/26918/
>
> > As per the last line in the log, I created a (blank) 404.html in my
> > templates directory, and it seemed to fix it.
>
> > However, is this the intended behavior (requiring a 404.html for
> > flatpages to work)? Should this be filed as a bug?
>
> You need to provide a 404.html independent of whether you are using
> flatpages.  Users can enter whatever they like in a browser address bar,
> your site should respond with a sensible error message when they try to get
> to a page that doesn't exist.
>
> http://code.djangoproject.com/ticket/3335
>
> raised the issue of flatpages needing 404.html and was closed wontfix, so
> I'd say the current behavior is intended.
>
> Karen
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Strange FastCGI problems

2007-12-05 Thread TP

I've been using Django for the past few months and had great results
with Apache and mod_python. However, I'd like to try and reduce the
amount of memory that is used by having multiple Apache's each with
their own copy of my application. I decided to try mod_fastcgi in
Apache and Django's FastCGI server capability.

While running with FastCGI, every now and then I get a random
exception 'RegexURLResolver' object has no attribute
'get_and_delete_messages'. In months of running my application with
mod_python I've never seen this.

I have another web app running under mod_python and it works fine
every time with FastCGI.

I'm using Apache 2.2.3, Centos, python 2.4.3, Django from SVN from
about early October 2007, flup 1.0, and mod_fastcgi 2.4.6.

Can anyone offer any pointers into what might be going wrong?

Thanks!

Tom
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: create_object generic view exampe

2007-12-05 Thread Malcolm Tredinnick


On Wed, 2007-12-05 at 13:56 +0100, Florian Lindner wrote:
> Hello,
> I'm looking for an example on how to use the  
> django.views.generic.create_update.create_object generic view (with  
> newforms).

Since that generic view hasn't been ported to newforms yet, you're
asking for something that isn't possible.

Malcolm

-- 
How many of you believe in telekinesis? Raise my hand... 
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: cache middleware and middlewareorder

2007-12-05 Thread Malcolm Tredinnick


On Wed, 2007-12-05 at 15:26 +0100, Paul Rauch wrote:
> hi list,
> 
> I got some Problems with the middlewareorder of cachemiddlerware,
> since it does not seem possible to order it the right way.
> 
> >Put the CacheMiddleware before any other middleware that might add
> >something to the Vary header (response middleware is applied in reverse
> >order). The following middleware modules do so:
> >
> >* SessionMiddleware adds Cookie
> >* GZipMiddleware adds Accept-Encoding
> >* LocaleMiddleware adds Accept-Language
> 
> this is part of the documentation and seems easy to follow, but:
> 
> >The cache middleware caches every page that doesn’t have GET or POST
> >parameters. Optionally, if the CACHE_MIDDLEWARE_ANONYMOUS_ONLY setting
> >is True, only anonymous requests (i.e., not those made by a logged-in
> >user) will be cached. This is a simple and effective way of disabling
> >caching for any user-specific pages (include Django’s admin interface).
> >Note that if you use CACHE_MIDDLEWARE_ANONYMOUS_ONLY, you should make
> >sure you’ve activated AuthenticationMiddleware and that
> >AuthenticationMiddleware appears before CacheMiddleware in your
> >MIDDLEWARE_CLASSES.
> 
> now problem is, that authentication middleware must have
> sessionmiddleware before itself. else django fails to start:
> 
> >AssertionError: The Django authentication middleware requires session
> >middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to
> >insert 'django.contrib.sessions.middleware.SessionMiddleware'.
> 
> If I try to get authenticationmiddleware after cachemiddleware I get
> another error:
> 
> >AssertionError: The Django cache middleware with
> >CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True requires authentication
> >middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to
> >insert 'django.contrib.auth.middleware.AuthenticationMiddleware'
> >before the CacheMiddleware.
> 
> 
> the only way to get a working djangoinstance is to put
> sessionmiddleware _before_ cachemiddleware, what you shouldn't do
> according to the docs.
> 
> is this a mistake in the docs or an error in django?

If you're using CACHE_MIDDLEWARE_ANONYMOUS_ONLY you need a different
middleware ordering, as the error message says. That setting is a real
hack and I'd love to implement it in a better way some day. At the
moment, though, where you place the cache middleware depends on whether
you're using that setting or not.

Malcolm

-- 
Honk if you love peace and quiet. 
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: Combating submission form Spam

2007-12-05 Thread John Lenton

On Dec 5, 2007 9:50 PM, Darryl Ross <[EMAIL PROTECTED]> wrote:
> Hey All,
>
> One of the websites I run has started getting spam via the contact form.
>
> What is the recommended way of dealing with this? Do I need to go the
> route of using something like django-captcha?
>
> Thanks for any insight.

you might be interested in using recaptcha; not only is it (in my
experience) easier to integrate, it also makes captchas not be a
complete waste of human cpu :)

recaptcha:
http://recaptcha.net/
an example of integrating django and recaptcha (not sure how accurate
or up to date, although it looks about right; just saving you the
google):
http://chewpichai.blogspot.com/2007/10/how-to-integrate-recaptcha-with-django.html


-- 
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
The trouble with a lot of self-made men is that they worship their creator.

--~--~-~--~~~---~--~~
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: Order By Calculated Value??

2007-12-05 Thread Darryl Ross
Hi Tane,

[untested with Many2Many, but should work, it works for ForeignKeys]

In your Entry save() method call the save method of each of your related
categories after you do your super().save()

{{{
class Entry(models.Model):
...
def save(self):
if not self.slug:
self.slug = slugify(self.title)
super(Entry, self).save()
for category in self.categories:
category.save()
...
}}}

Then in the save method for your Category object you need to calculate
the number of entries in that category before you call super().save()

{{{
class Category(models.Model):
...
def save(self):
if not self.slug:
self.slug = slugify(self.name)
self.num_entries = self.entry_set.count()
super(Category, self).save()
...
}}}

Hope that helps, or at least gives you a pointer.

Regards
Darryl



Tane Piper wrote:
> Here is my blog application, which contains the two models:
> 
> from django.db import models
> from django.db.models import permalink
> from django.core import urlresolvers
> from django.contrib.auth.models import User
> from django.template.defaultfilters import slugify
> 
> import datetime
> # Create your models here.
> 
> class Category(models.Model):
> """ A Category is a way to manage the taxonomy of the site"""
> name=models.CharField(max_length=50) #The name of the category
> description=models.TextField()
> slug=models.CharField(max_length=75, null=True, blank=True)
> active=models.BooleanField()
> generate_feed=models.BooleanField()
> parent=models.ForeignKey('self', null=True, blank=True)
> def __unicode__(self):
> return self.name
> def save(self):
> if not self.slug:
> self.slug = slugify(self.name)
> super(Category, self).save()
> def num_entries(self):
> """Returns the number of entries in this category"""
> return self.entry_set.count()
> num_entries.short_description = "Number of Entries"
> def get_absolute_url(self):
> """Get the URL of this entry to create a permalink"""
> return ('cat-detail', (), {
> "slug": self.slug
> })
> get_absolute_url = permalink(get_absolute_url)
> class Meta:
> verbose_name_plural = 'Categories'
> class Admin:
> fields = (
>   ('Category Details', {'fields': ('name',
> 'description', 'parent',)}),
>   ('Category Settings', {'fields': ('active',
> 'generate_feed', 'slug',)}),
> )
> list_display = ('name', 'slug', 'active', 'generate_feed',
> 'num_entries', 'parent',)
> search_fields = ['name','parent']
> 
> PUBLISHED_CHOICES = (
> (0, 'Draft'),
> (1, 'Pending Review'),
> (2, 'Published'),
> (3, 'Archived'),
> )
> 
> class Entry(models.Model):
> title=models.CharField(max_length=255)
> body=models.TextField()
> user=models.ForeignKey(User)
> slug=models.CharField(max_length=75, null=True, blank=True)
> pub_date=models.DateTimeField('date published')
> published=models.IntegerField(max_length=1,
> choices=PUBLISHED_CHOICES, verbose_name="Publishing Status")
> front_page=models.BooleanField(default=True)
> sticky=models.BooleanField()
> allow_comments=models.BooleanField(default=True)
> truncate=models.BooleanField()
> categories=models.ManyToManyField(Category, limit_choices_to = 
> {'active':1})
> def save(self):
> if not self.slug:
> self.slug = slugify(self.title)
> super(Entry, self).save()
> def __unicode__(self):
> return "%s" % self.title
> def was_published_today(self):
> """Flag to show if post was published today"""
> return self.pub_date.date() == datetime.date.today()
> was_published_today.short_description = 'Published today?'
> def is_published(self):
> return bool(self.published==2)
> is_published.short_description = 'Has Been Published?'
> def get_absolute_url(self):
> """Get the URL of this entry to create a permalink"""
> return ('news-detail', (), {
> "slug": self.slug,
> "year":self.pub_date.year,
> "month":self.pub_date.strftime("%b").lower(),
> "day":self.pub_date.day
> })
> get_absolute_url = permalink(get_absolute_url)
> class Meta:
> verbose_name_plural = 'Entries'
> ordering = ['-pub_date']
> class Admin:
>fields = (
>   ('Entry Content', {'fields': ('title', 'body',
> 'user', 'categories')}),
>   ('Date information', {'fields': ('pub_date',)}),
>   ('Publishing Details', {'fields': ('slug',
> 'published', 'front_page', 'allow_comments', 'sticky', 'truncate')}),
> )
>list_display = ('title', 'user', 'front_page', 'sticky',
> 'allow_comments', 'truncate', 'pub_date', 'is_published',
> 'was_published_today', )
>   

Re: Combating submission form Spam

2007-12-05 Thread Joseph Heck

I'd recommend something along those lines - otherwise they'll hit you
hard and keep coming!

-joe

On Dec 5, 2007 4:50 PM, Darryl Ross <[EMAIL PROTECTED]> wrote:
> Hey All,
>
> One of the websites I run has started getting spam via the contact form.
>
> What is the recommended way of dealing with this? Do I need to go the
> route of using something like django-captcha?
>
> Thanks for any insight.
>
> Regards
> Darryl
>
>

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



Combating submission form Spam

2007-12-05 Thread Darryl Ross
Hey All,

One of the websites I run has started getting spam via the contact form.

What is the recommended way of dealing with this? Do I need to go the
route of using something like django-captcha?

Thanks for any insight.

Regards
Darryl



signature.asc
Description: OpenPGP digital signature


Re: Unhandled Exception on new server (Lighttpd + FastCGI)

2007-12-05 Thread Karen Tracey
On 12/5/07, Derek Payton <[EMAIL PROTECTED]> wrote:
>
>
> Apparently there was an issue with my svn. I downgraded to a previous
> revision (pre-6778), then back to trunk. Everything is working now,
> except flatpages. Here's the error from lighttpd's log:
> http://dpaste.com/26918/
>
> As per the last line in the log, I created a (blank) 404.html in my
> templates directory, and it seemed to fix it.
>
> However, is this the intended behavior (requiring a 404.html for
> flatpages to work)? Should this be filed as a bug?


You need to provide a 404.html independent of whether you are using
flatpages.  Users can enter whatever they like in a browser address bar,
your site should respond with a sensible error message when they try to get
to a page that doesn't exist.

http://code.djangoproject.com/ticket/3335

raised the issue of flatpages needing 404.html and was closed wontfix, so
I'd say the current behavior is intended.

Karen

--~--~-~--~~~---~--~~
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: Unhandled Exception on new server (Lighttpd + FastCGI)

2007-12-05 Thread Derek Payton

Apparently there was an issue with my svn. I downgraded to a previous
revision (pre-6778), then back to trunk. Everything is working now,
except flatpages. Here's the error from lighttpd's log: http://dpaste.com/26918/

As per the last line in the log, I created a (blank) 404.html in my
templates directory, and it seemed to fix it.

However, is this the intended behavior (requiring a 404.html for
flatpages to work)? Should this be filed as a bug?

Thank you,
--Derek
--~--~-~--~~~---~--~~
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: Installation - symlink vs. python setup.py install

2007-12-05 Thread Graham Dumpleton

Okay, I had a part brain fade there. Was confusing /Library/Frameworks/
Python with /Library/Python. The /Library/Frameworks/Python is what
MacPorts uses.

Also looks like Python 2.5 on Mac OS X 10.5 sets up sys.path
differently, ie., uses shorter /Library/Python/2.5/sites-packages
instead of longer path out of /System/Library/Frameworks/Python.

On Mac OS X 10.4 and Python 2.3 the long path version is just a
symlink to the short path version.

 8 lrwxr-xr-x 1 root  wheel  56 Jul 13  2006 site-packages -
> ../../../../../../../../Library/Python/2.3/site-packages

Ie., they should effectively be the same directory, yet your comment
about partial Django in long path suggests they aren't, or what you
are symlinking to with the django link isn't correct in the first
place.

I have 10.5 on a firewire drive here so I'll try and boot it up and
see how it links the two directories if it does.

Graham

On Dec 6, 11:01 am, Greig Rapley <[EMAIL PROTECTED]> wrote:
> $ sudo port installed
>
> does not include python in the list returned, so I assume I am using
> the OS version.
>
> $ which python
> /usr/bin/python
>
> and,
>
> $ python -c "from distutils.sysconfig import get_python_lib; print
> get_python_lib()"
> /Library/Python/2.5/site-packages
>
> I have been symlinking into /Library/Python/2.5/site-packages.
>
> I have found the *other* site-packages directory, it is;
>
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> site-packages
>
> but there is only a partial django directory in there;
>
> django/conf
> django/contrib
>
> Ok, so I have removed MacPorts following the instructions in the FAQ.
>
> I have installed the testhandler and here are the results;
>
> General information
>
> Apache version  Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.7l DAV/2
> mod_python/3.3.1 Python/2.5.1
> Apache threaded MPM No (single thread MPM)
> Apache forked MPM   Yes, maximum 256 processes
> Apache server root  /usr
> Apache document root/Library/WebServer/Documents
> Apache error log/private/var/log/apache2/error_log (view last 100
> lines)
> Python sys.version  2.5.1 (r251:54863, Oct 5 2007, 21:08:09) [GCC 4.0.1
> (Apple Inc. build 5465)]
> Python sys.path
> /Library/Python/2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.5-
> i386.egg
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python25.zip
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> plat-darwin
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> plat-mac
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> plat-mac/lib-scriptpackages
> /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/
> python
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> lib-tk
> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> lib-dynload
> /Library/Python/2.5/site-packages
> /Library/Python/2.5/site-packages/PIL
> /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/
> python/PyObjC
> Python interpreter name main_interpreter
> mod_python.publisher available  Yes
> mod_python.psp availableNo
>
> which still works without MacPorts.
>
> And;
>
> $ python
> Python 2.5.1 (r251:54863, Oct  5 2007, 21:08:09)
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import django.core.handlers.modpython
>
> Looks like the same Python from the command line as from within
> mod_python, and yet the command line interpreter has no problem
> finding django.core.handlers.modpython !
>
> Still hoping I can find a way to symlink instead of installing every
> svn update :-)
>
> On Dec 5, 1:13 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > BTW, that it is looking in:
>
> >   /Library/Python/2.5/site-packages
>
> > suggests your mod_python is using MacPorts Python.
>
> > Where were you actually symlinking in to?
>
> > If you were symlinking into /System/Library/Frameworks/Python/Current/
> > lib/site-packages it wouldn't find it as it doesn't look there.
>
> > Can you just use the OS version of Python 2.5 on MacOS X 10.5 and not
> > the MacPorts version. I have seen someone else having odd problems
> > when they tried to install MacPorts 2.5 when the OS already supplied
> > 2.5.
>
> > Graham
>
> > On Dec 5, 11:57 am, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Dec 5, 10:29 am, Greig Rapley <[EMAIL PROTECTED]> wrote:
>
> > > > Unfortunately that hasn't worked. I even tried chown'ing the entire
> > > > tree beneath django-trunk, and the symlink itself, to www:www.  Still
> > > > mod_python says that it cannot import django.core.handlers.modpython.
> > > > I have gone through your mod_python mptest exercise again and
> > > > everything works fine.  Then, I simply run python setup.py install
> > > > 

(solved) Re: Custom template tag and filters in resolve_variable

2007-12-05 Thread Michal Ludvig

Michal Ludvig wrote:

> for the project I'm working on I needed to create a custom template tag,
> call it 'mytag'.
> 
> If I use it as {% mytag something %} everything goes fine (where
> 'something' is a string passed to the template).
> However I can't add any filters to that 'something'. As soon as I do:
> {% mytag something|upper %}
> I get an exception:
>   VariableDoesNotExist at /test/
>   Failed lookup for key [something|upper]
> 
> That leads to a code in MytagNode.render() method:
>   actual_message = resolve_variable(self.message, context)
> where self.message is the argument passed to the macro, in this case
> it's a string 'something|upper'.
> 
> Is there an easy way to run all the attached filters in MytagNode?

For the record:
There is a FilterExpression class in django.template that does exactly 
what I need. So for the tag implementation, instead of:

===
from django.template import resolve_variable

@register.tag
def mytag(parser, token):
tag_name, message = token.split_contents()
[...]
return MytagNode(message)

class MytagNode(template.Node):
[...]
def render(self, context):
actual_message = resolve_variable(self.message, context)
[...]
===

I do it like this:

===
from django.template import FilterExpression

@register.tag
def mytag(parser, token):
[...]
filter_expression = FilterExpression(message, parser)
return MytagNode(filter_expression)

class MytagNode(template.Node):
[...]
def render(self, context):
actual_message = self.filter_expression.resolve(context)
[...]
===

The filter_expression.resolve(context) runs all the filters attached to 
the variable and things work as expected. The 'parser' argument even 
makes it aware of custom filters loaded through {% load ... %} tags.

Lesson learned, note taken.

Michal



--~--~-~--~~~---~--~~
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: Installation - symlink vs. python setup.py install

2007-12-05 Thread Greig Rapley

$ sudo port installed

does not include python in the list returned, so I assume I am using
the OS version.

$ which python
/usr/bin/python

and,

$ python -c "from distutils.sysconfig import get_python_lib; print
get_python_lib()"
/Library/Python/2.5/site-packages

I have been symlinking into /Library/Python/2.5/site-packages.

I have found the *other* site-packages directory, it is;

/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages

but there is only a partial django directory in there;

django/conf
django/contrib

Ok, so I have removed MacPorts following the instructions in the FAQ.

I have installed the testhandler and here are the results;

General information

Apache version  Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.7l DAV/2
mod_python/3.3.1 Python/2.5.1
Apache threaded MPM No (single thread MPM)
Apache forked MPM   Yes, maximum 256 processes
Apache server root  /usr
Apache document root/Library/WebServer/Documents
Apache error log/private/var/log/apache2/error_log (view last 100
lines)
Python sys.version  2.5.1 (r251:54863, Oct 5 2007, 21:08:09) [GCC 4.0.1
(Apple Inc. build 5465)]
Python sys.path
/Library/Python/2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.5-
i386.egg
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python25.zip
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/
python
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
lib-dynload
/Library/Python/2.5/site-packages
/Library/Python/2.5/site-packages/PIL
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/
python/PyObjC
Python interpreter name main_interpreter
mod_python.publisher available  Yes
mod_python.psp availableNo

which still works without MacPorts.

And;

$ python
Python 2.5.1 (r251:54863, Oct  5 2007, 21:08:09)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django.core.handlers.modpython
>>>

Looks like the same Python from the command line as from within
mod_python, and yet the command line interpreter has no problem
finding django.core.handlers.modpython !

Still hoping I can find a way to symlink instead of installing every
svn update :-)

On Dec 5, 1:13 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> BTW, that it is looking in:
>
>   /Library/Python/2.5/site-packages
>
> suggests your mod_python is using MacPorts Python.
>
> Where were you actually symlinking in to?
>
> If you were symlinking into /System/Library/Frameworks/Python/Current/
> lib/site-packages it wouldn't find it as it doesn't look there.
>
> Can you just use the OS version of Python 2.5 on MacOS X 10.5 and not
> the MacPorts version. I have seen someone else having odd problems
> when they tried to install MacPorts 2.5 when the OS already supplied
> 2.5.
>
> Graham
>
> On Dec 5, 11:57 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Dec 5, 10:29 am, Greig Rapley <[EMAIL PROTECTED]> wrote:
>
> > > Unfortunately that hasn't worked. I even tried chown'ing the entire
> > > tree beneath django-trunk, and the symlink itself, to www:www.  Still
> > > mod_python says that it cannot import django.core.handlers.modpython.
> > > I have gone through your mod_python mptest exercise again and
> > > everything works fine.  Then, I simply run python setup.py install
> > > again, and it all works fine.  Any further ideas ?  Can I try
> > > importing django modules using mptest ?
>
> > Set PythonHandler to mod_python::testhandler and see what sys.path is
> > actually being set to for a request.
>
> > Graham
>
> > > On Dec 3, 9:38 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > Apache generally runs as a special user. This user must have read
> > > > access to those Django modules you have symlinked into the Python site-
> > > > packages directory. Thus if the files are not readable to others, or
> > > > any of the directories from the root right down to where the Django
> > > > software is actually installed are not readable/searchable to others,
> > > > then Python running under Apache will fail in being able to import the
> > > > modules.
>
> > > > Graham
>
> > > > On Dec 4, 5:25 am, Greig Rapley <[EMAIL PROTECTED]> wrote:
>
> > > > > Actually, I have just rerun "python setup.py install" to get my
> > > > > installation working again and noticed the running install_egg_info
> > > > > that happens last.  Might this have something to do with my problems
> > > > > when using a symlink instead ?
>
> > > > > 

Is there a better way to do this with the DB API?

2007-12-05 Thread globophobe

I've read the documentation. I admit to being more than a little
deficient with databases. Can anybody suggest a better way?

if len(study) < 20:
exclude = user.study_set.filter(stack=stack).values('card')
cards = stack.card_set.exclude(id__in=[i.get('card') for i in
exclude])[:20-len(study)]
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



"Between" bug when using SQLite?

2007-12-05 Thread Doug Van Horn

I'm running into a funny issue when testing with SQLite3 (Python 2.5).

I have a model with the following (simplified):

class Event(models.Model):
event_title = models.CharField()
event_from_date = models.DateField()

I create an event on 2008-01-01 (January 1st) and on 2008-01-02
(January 2nd).

I run the following in the shell:

In [10]: Event.objects.filter(event_from_date__year=2008)
Out[10]: []

In [11]: Event.objects.filter(event_from_date__month=1)
Out[11]: [, ]

In [12]: Event.objects.filter(event_from_date__year=2008,
event_from_date__month=1)
Out[12]: []

Here are the queries (I edited out a bunch of other fields from the
select clause, but nothing from the where clause, so they're not
exactly as output from django):

In [18]: connection.queries
Out[18]:
[{'sql': u'SELECT
"app_event"."id","app_event"."event_from_date","app_event"."title"
FROM "app_event" WHERE ("app_event"."event_from_date" BETWEEN
2008-01-01 00:00:00 AND 2008-12-31 23:59:59.99) ORDER BY
"app_event"."event_from_date" ASC, "app_event"."title" ASC',
  'time': '0.001'},
 {'sql': u'SELECT
"app_event"."id","app_event"."event_from_date","app_event"."title"
FROM "app_event" WHERE (django_extract("month",
"app_event"."event_from_date") = 1) ORDER BY
"app_event"."event_from_date" ASC, "app_event"."title" ASC',
  'time': '0.001'},
 {'sql': u'SELECT
"app_event"."id","app_event"."event_from_date","app_event"."title"
FROM "app_event" WHERE (django_extract("month",
"app_event"."event_from_date") = 1 AND "app_event"."event_from_date"
BETWEEN 2008-01-01 00:00:00 AND 2008-12-31 23:59:59.99) ORDER BY
"app_event"."event_from_date" ASC, "app_event"."title" ASC',
  'time': '0.001'}]


Could it be that the 'year' predicate is missing the 'django_extract'
function?


Thanks for any help...


Doug Van Horn
--~--~-~--~~~---~--~~
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-tagging with latest svn

2007-12-05 Thread erikankrom



On Dec 5, 4:54 pm, Jonathan Buchanan <[EMAIL PROTECTED]>
wrote:
> erikankrom wrote:
> > I'm having trouble getting the latest django svn, and svn unmodified
> > versions of both coltrane (http://code.google.com/p/coltrane-blog/)
> > and basic blog (http://code.google.com/p/django-basic-blog/) to import
> > correctly with django-tagging (http://code.google.com/p/django-
> > tagging/).  Both have dependencies on django-tagging and are hanging
> > up on the following error from that code:
>
> > The ONLY thing I did change was in basic blog models.py:
> > @permalink
> > get_absolute_url = permalink(get_absolute_url)
> > to make it python 2.3 compatible
> > and maxlength= to max_length= for incompatibility with latest SVN
>
> > My settings installed apps:
> > INSTALLED_APPS = (
> > 'django.contrib.admin',
> > 'django.contrib.auth',
> > 'django.contrib.contenttypes',
> > 'django.contrib.sessions',
> > 'django.contrib.sites',
> > 'django.contrib.flatpages',
> > 'django.contrib.comments',
> > 'django.contrib.markup',
> > 'myproject.template_utils',
> > 'myproject.comment_utils',
> > 'myproject.tagging',
> > 'myproject.blog',
> > #'myproject.coltrane',
> > )
>
> > The error when loadingwww.site.com/admin:
>
> > File "/home/username/django_projects/myproject/tagging/models.py" in ?
> >   8. from tagging.managers import TagManager, TaggedItemManager
>
> > Exception Type: ImportError at /admin/
> > Exception Value: No module named tagging.managers
>
> > All the syntax looks correct to me, but I am also fairly new to
> > django, so any help is appreciated.  This is a pretty bare bones
> > installation so far.  If I comment out blog or coltrane, admin loads
> > just fine, no errors.  syncdb works fine as well, even with tagging
> > and blog uncommented.
>
> The tagging application needs to be on your PYTHONPATH (i.e. the
> 'tagging' folder should be sitting on the same level as your 'myproject'
> directory or in any other directory which is on your PYTHONPATH), that's
> why the docs specify that you need to check the 'tagging' folder out to
> somewhere on your PYTHONPATH and have 'tagging' in your INSTALLED_APPS.
>
> Another option could be to also add your 'myproject' directory to the
> PYTHONPATH, so when any application tries to import from the 'tagging'
> module, it will be found.
>
> If you're finding the whole application/project thing confusing, these
> articles may be useful :)
>
> http://www.pointy-stick.com/blog/2007/11/09/django-tip-developing-wit...http://www.b-list.org/weblog/2007/nov/09/projects/
>
> Regards,
> Jonathan.

Thanks Jonathan, the articles referenced really help clarify things.
I have the code in the correct directories now, and all working.  I
had the blinders on with reference to my individual project
directory.  This should help avoid duplication when referencing these
from multiple "projects" once I get them going.  I want to do a couple
of blog-type sites, and I only have to checkout/update the code once
for each.  Thanks for the info!
--~--~-~--~~~---~--~~
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: Unhandled Exception on new server (Lighttpd + FastCGI)

2007-12-05 Thread akaihola

Derek just noticed in IRC that [6895] is still failing on flatpages.
--~--~-~--~~~---~--~~
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-tagging with latest svn

2007-12-05 Thread Jonathan Buchanan

erikankrom wrote:
> I'm having trouble getting the latest django svn, and svn unmodified
> versions of both coltrane (http://code.google.com/p/coltrane-blog/)
> and basic blog (http://code.google.com/p/django-basic-blog/) to import
> correctly with django-tagging (http://code.google.com/p/django-
> tagging/).  Both have dependencies on django-tagging and are hanging
> up on the following error from that code:
> 
> The ONLY thing I did change was in basic blog models.py:
> @permalink
> get_absolute_url = permalink(get_absolute_url)
> to make it python 2.3 compatible
> and maxlength= to max_length= for incompatibility with latest SVN
> 
> My settings installed apps:
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.flatpages',
> 'django.contrib.comments',
> 'django.contrib.markup',
> 'myproject.template_utils',
> 'myproject.comment_utils',
> 'myproject.tagging',
> 'myproject.blog',
> #'myproject.coltrane',
> )
> 
> The error when loading www.site.com/admin:
> 
> File "/home/username/django_projects/myproject/tagging/models.py" in ?
>   8. from tagging.managers import TagManager, TaggedItemManager
> 
> Exception Type: ImportError at /admin/
> Exception Value: No module named tagging.managers
> 
> All the syntax looks correct to me, but I am also fairly new to
> django, so any help is appreciated.  This is a pretty bare bones
> installation so far.  If I comment out blog or coltrane, admin loads
> just fine, no errors.  syncdb works fine as well, even with tagging
> and blog uncommented.

The tagging application needs to be on your PYTHONPATH (i.e. the 
'tagging' folder should be sitting on the same level as your 'myproject' 
directory or in any other directory which is on your PYTHONPATH), that's 
why the docs specify that you need to check the 'tagging' folder out to 
somewhere on your PYTHONPATH and have 'tagging' in your INSTALLED_APPS.

Another option could be to also add your 'myproject' directory to the 
PYTHONPATH, so when any application tries to import from the 'tagging' 
module, it will be found.

If you're finding the whole application/project thing confusing, these 
articles may be useful :)

http://www.pointy-stick.com/blog/2007/11/09/django-tip-developing-without-projects/
http://www.b-list.org/weblog/2007/nov/09/projects/

Regards,
Jonathan.

--~--~-~--~~~---~--~~
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: Unhandled Exception on new server (Lighttpd + FastCGI)

2007-12-05 Thread Derek Payton

Chris,

[EMAIL PROTECTED]:~/django-trunk$ svn update
At revision 6897.

Any ideas?

Thank you,
--Derek
--~--~-~--~~~---~--~~
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-tagging with latest svn

2007-12-05 Thread erikankrom

I'm having trouble getting the latest django svn, and svn unmodified
versions of both coltrane (http://code.google.com/p/coltrane-blog/)
and basic blog (http://code.google.com/p/django-basic-blog/) to import
correctly with django-tagging (http://code.google.com/p/django-
tagging/).  Both have dependencies on django-tagging and are hanging
up on the following error from that code:

The ONLY thing I did change was in basic blog models.py:
@permalink
get_absolute_url = permalink(get_absolute_url)
to make it python 2.3 compatible
and maxlength= to max_length= for incompatibility with latest SVN

My settings installed apps:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.flatpages',
'django.contrib.comments',
'django.contrib.markup',
'myproject.template_utils',
'myproject.comment_utils',
'myproject.tagging',
'myproject.blog',
#'myproject.coltrane',
)

The error when loading www.site.com/admin:

File "/home/username/django_projects/myproject/tagging/models.py" in ?
  8. from tagging.managers import TagManager, TaggedItemManager

Exception Type: ImportError at /admin/
Exception Value: No module named tagging.managers

All the syntax looks correct to me, but I am also fairly new to
django, so any help is appreciated.  This is a pretty bare bones
installation so far.  If I comment out blog or coltrane, admin loads
just fine, no errors.  syncdb works fine as well, even with tagging
and blog uncommented.
--~--~-~--~~~---~--~~
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: Unhandled Exception on new server (Lighttpd + FastCGI)

2007-12-05 Thread Chris Moffitt
Sounds like this bug - http://code.djangoproject.com/ticket/6063

which was supposed to be fixed in [6895].  Are you sure you have the most
recent checkout?

-Chris

--~--~-~--~~~---~--~~
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: Order By Calculated Value??

2007-12-05 Thread Tane Piper

Here is my blog application, which contains the two models:

from django.db import models
from django.db.models import permalink
from django.core import urlresolvers
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify

import datetime
# Create your models here.

class Category(models.Model):
""" A Category is a way to manage the taxonomy of the site"""
name=models.CharField(max_length=50) #The name of the category
description=models.TextField()
slug=models.CharField(max_length=75, null=True, blank=True)
active=models.BooleanField()
generate_feed=models.BooleanField()
parent=models.ForeignKey('self', null=True, blank=True)
def __unicode__(self):
return self.name
def save(self):
if not self.slug:
self.slug = slugify(self.name)
super(Category, self).save()
def num_entries(self):
"""Returns the number of entries in this category"""
return self.entry_set.count()
num_entries.short_description = "Number of Entries"
def get_absolute_url(self):
"""Get the URL of this entry to create a permalink"""
return ('cat-detail', (), {
"slug": self.slug
})
get_absolute_url = permalink(get_absolute_url)
class Meta:
verbose_name_plural = 'Categories'
class Admin:
fields = (
  ('Category Details', {'fields': ('name',
'description', 'parent',)}),
  ('Category Settings', {'fields': ('active',
'generate_feed', 'slug',)}),
)
list_display = ('name', 'slug', 'active', 'generate_feed',
'num_entries', 'parent',)
search_fields = ['name','parent']

PUBLISHED_CHOICES = (
(0, 'Draft'),
(1, 'Pending Review'),
(2, 'Published'),
(3, 'Archived'),
)

class Entry(models.Model):
title=models.CharField(max_length=255)
body=models.TextField()
user=models.ForeignKey(User)
slug=models.CharField(max_length=75, null=True, blank=True)
pub_date=models.DateTimeField('date published')
published=models.IntegerField(max_length=1,
choices=PUBLISHED_CHOICES, verbose_name="Publishing Status")
front_page=models.BooleanField(default=True)
sticky=models.BooleanField()
allow_comments=models.BooleanField(default=True)
truncate=models.BooleanField()
categories=models.ManyToManyField(Category, limit_choices_to = {'active':1})
def save(self):
if not self.slug:
self.slug = slugify(self.title)
super(Entry, self).save()
def __unicode__(self):
return "%s" % self.title
def was_published_today(self):
"""Flag to show if post was published today"""
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'
def is_published(self):
return bool(self.published==2)
is_published.short_description = 'Has Been Published?'
def get_absolute_url(self):
"""Get the URL of this entry to create a permalink"""
return ('news-detail', (), {
"slug": self.slug,
"year":self.pub_date.year,
"month":self.pub_date.strftime("%b").lower(),
"day":self.pub_date.day
})
get_absolute_url = permalink(get_absolute_url)
class Meta:
verbose_name_plural = 'Entries'
ordering = ['-pub_date']
class Admin:
   fields = (
  ('Entry Content', {'fields': ('title', 'body',
'user', 'categories')}),
  ('Date information', {'fields': ('pub_date',)}),
  ('Publishing Details', {'fields': ('slug',
'published', 'front_page', 'allow_comments', 'sticky', 'truncate')}),
)
   list_display = ('title', 'user', 'front_page', 'sticky',
'allow_comments', 'truncate', 'pub_date', 'is_published',
'was_published_today', )
   list_filter = ['pub_date', 'categories']
   search_fields = ['body', 'title']
   date_hierarchy = 'pub_date'
   ordering = ('pub_date',)

On Dec 5, 2007 6:28 PM, RajeshD <[EMAIL PROTECTED]> wrote:
>
>
> >
> > Hope that makes sense, as if I can do it this way instead of
> > calculating it on the view, that would make this inclusion tag so much
> > easier.
>
> What does your Entry model look like?
>
> >
>



-- 
Tane Piper
Blog - http://digitalspaghetti.me.uk
AJAX Pastebin - http://pastemonkey.org

This email is: [ ] blogable [ x ] ask first [ ] private

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



Unhandled Exception on new server (Lighttpd + FastCGI)

2007-12-05 Thread Derek Payton

Hello,

I was recently charged with installing a new development server at
work, and I'm having some trouble getting Django to work as FastCGI
under Lighttpd. The new server is setup identical to the old server,
except for some hardware upgrades and we moved from Ubuntu Dapper to
Ubuntu Gutsy.

Lighttpd starts with no problems, and so does the bash script which
starts the fastcgi daemon, but when I visit the URL
(ccsx.dev.ccsx.com) in my browser, I get an "Unhandled Exception"
error.

My startup script can be found here: http://dpaste.com/26896/ (Got it
from the docs, and it works well on the old server)
My lighttpd config can be found here: http://dpaste.com/26897/ (Same
as on the old server)
This is what's in the lighttpd error log: http://dpaste.com/26888/
(Could this be an issue with flup?)

At first, given what's in the log, I thought it was a flup problem. I
had originally installed flup via apt, so I uninstalled and
reinstalled it (again, via apt) but got the same error. So I
uninstalled it and reinstalled it using easy_install, and am still
getting the same error.

If I manually run "python manage.py runserver 0.0.0.0:8000" I can
visit ccsx.dev.ccsx.com:8000 and it works (aside from the /media/
folder, as Django isn't setup to serve that.)

By the way, I'm running the latest svn release of Django (currently
6897)

Anyone know what might be going on?
--~--~-~--~~~---~--~~
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: Issues trying to Caching a View

2007-12-05 Thread Jeremy Dunck

Try setting your mime type appropriately.
HttpResponse(mimetype="application/x-javascript")

Notice this in your view-generated-js response:
Content-Type: text/html; charset=utf-8

On Dec 5, 2007 3:08 PM, Matt <[EMAIL PROTECTED]> wrote:
>
> Alright... still haven't figured it out. The Vary: Cookie header gets
> added because I am using user authentication stuff and the view
> depends on the user. But I still want the browser to cache the file. I
> was thinking of using @cache_control(private=True, max_age=37000)  in
> order to deal with the user specific factor.
>
> Instead, with Vary: Cookie, the browser goes back to the server and
> grabs the file again. Which is not what I want.
>
> Any help would be appreciated.
>
> Thanks,
> Matt
>
>
>
>
> On Dec 5, 12:26 pm, Matt <[EMAIL PROTECTED]> wrote:
> > Alright... I think I might have tracked it down. I think it's an issue
> > with "Vary: Cookie" and it appears their is a fix for making this
> > header only show up when the request varies on the 
> > cookie.http://code.djangoproject.com/ticket/3586
> >
> > Haven't confirmed this yet, but seem like the issue.
> >
> > Matt
> >
> > On Dec 4, 10:58 am, Matt <[EMAIL PROTECTED]> wrote:
> >
> > > Hi. I am trying to get a JS file cached by the browser using per-view
> > > caching with @cache_page and/or @cache_control. But the file is not
> > > getting cached as I would like.
> >
> > > I have the following scenario: A view generates a JavaScript file that
> > > is unique for each user. However the JS file rarely changes for a
> > > user.
> >
> > > In view.py---
> > > @cache_page(37000)
> > > @cache_control(private=True, max_age=37000)
> > > def user_unique_js(request):
> > > -
> >
> > > When accessing the page using FireFox I can check out the HTTP headers
> > > and they look like the following:
> > > 
> > > HTTP/1.1 200 OK
> > > Date: Tue, 04 Dec 2007 14:59:43 GMT
> > > Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/
> > > 5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c
> > > Expires: Wed, 05 Dec 2007 01:16:23 GMT
> > > Vary: Cookie
> > > Last-Modified: Tue, 04 Dec 2007 14:59:43 GMT
> > > Etag: af0d1f45cb03ee198342ddb280f3164d
> > > Cache-Control: private, max-age=37000
> > > Content-Type: text/html; charset=utf-8
> > > -
> >
> > > However, from looking at the cache using about:cache, it appears the
> > > JS file get reloaded each time the page is loaded.
> >
> > >  From about:cache -
> > > last fetched: 2007-12-04 10:54:08
> > > last modified: 2007-12-04 10:54:04
> > > expires: 2007-12-04 20:16:23
> > > ---
> >
> > > The static JS files served by Apache do get cached. Their headers look
> > > like the following:
> > > --
> > > HTTP/1.1 200 OK
> > > Date: Tue, 04 Dec 2007 14:58:27 GMT
> > > Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/
> > > 5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c
> > > Last-Modified: Mon, 03 Dec 2007 19:59:20 GMT
> > > Etag: "67bf-8136-37463600"
> > > Accept-Ranges: bytes
> > > Content-Length: 33078
> > > Content-Type: application/x-javascript
> > > --
> >
> > >  From about:cache -
> > > last fetched: 2007-12-04 10:54:06
> > > last modified: 2007-12-04 10:52:48
> > > expires: 2007-12-04 11:52:21
> > > --
> >
> > > Does anyone have an idea of what the issue could? Am I attempting to
> > > cache the file properly?
> >
> > > Thanks,
> > > Matt
> >
>

--~--~-~--~~~---~--~~
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: Issues trying to Caching a View

2007-12-05 Thread Matt

Alright... still haven't figured it out. The Vary: Cookie header gets
added because I am using user authentication stuff and the view
depends on the user. But I still want the browser to cache the file. I
was thinking of using @cache_control(private=True, max_age=37000)  in
order to deal with the user specific factor.

Instead, with Vary: Cookie, the browser goes back to the server and
grabs the file again. Which is not what I want.

Any help would be appreciated.

Thanks,
Matt



On Dec 5, 12:26 pm, Matt <[EMAIL PROTECTED]> wrote:
> Alright... I think I might have tracked it down. I think it's an issue
> with "Vary: Cookie" and it appears their is a fix for making this
> header only show up when the request varies on the 
> cookie.http://code.djangoproject.com/ticket/3586
>
> Haven't confirmed this yet, but seem like the issue.
>
> Matt
>
> On Dec 4, 10:58 am, Matt <[EMAIL PROTECTED]> wrote:
>
> > Hi. I am trying to get a JS file cached by the browser using per-view
> > caching with @cache_page and/or @cache_control. But the file is not
> > getting cached as I would like.
>
> > I have the following scenario: A view generates a JavaScript file that
> > is unique for each user. However the JS file rarely changes for a
> > user.
>
> > In view.py---
> > @cache_page(37000)
> > @cache_control(private=True, max_age=37000)
> > def user_unique_js(request):
> > -
>
> > When accessing the page using FireFox I can check out the HTTP headers
> > and they look like the following:
> > 
> > HTTP/1.1 200 OK
> > Date: Tue, 04 Dec 2007 14:59:43 GMT
> > Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/
> > 5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c
> > Expires: Wed, 05 Dec 2007 01:16:23 GMT
> > Vary: Cookie
> > Last-Modified: Tue, 04 Dec 2007 14:59:43 GMT
> > Etag: af0d1f45cb03ee198342ddb280f3164d
> > Cache-Control: private, max-age=37000
> > Content-Type: text/html; charset=utf-8
> > -
>
> > However, from looking at the cache using about:cache, it appears the
> > JS file get reloaded each time the page is loaded.
>
> >  From about:cache -
> > last fetched: 2007-12-04 10:54:08
> > last modified: 2007-12-04 10:54:04
> > expires: 2007-12-04 20:16:23
> > ---
>
> > The static JS files served by Apache do get cached. Their headers look
> > like the following:
> > --
> > HTTP/1.1 200 OK
> > Date: Tue, 04 Dec 2007 14:58:27 GMT
> > Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/
> > 5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c
> > Last-Modified: Mon, 03 Dec 2007 19:59:20 GMT
> > Etag: "67bf-8136-37463600"
> > Accept-Ranges: bytes
> > Content-Length: 33078
> > Content-Type: application/x-javascript
> > --
>
> >  From about:cache -
> > last fetched: 2007-12-04 10:54:06
> > last modified: 2007-12-04 10:52:48
> > expires: 2007-12-04 11:52:21
> > --
>
> > Does anyone have an idea of what the issue could? Am I attempting to
> > cache the file properly?
>
> > Thanks,
> > Matt
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



about nesh.thumbnails

2007-12-05 Thread Lic. José M. Rodriguez Bacallao
hi folks, I'm using the django app "nesh.thumbnails" for my thumbnails
stuff and I got two problems:
1- how can I generate thumbnails for the admin interface using this
app, I try this approach:

def admin_thumbnail(self):
if self.image:
return '{%% load nesh.thumbnails %%} ' %
(self.get_image_url(),)
return ''
admin_thumbnail.short_description = 'Thumbnail'
admin_thumbnail.allow_tags = True

but it doesn't work, then I try this:

def admin_thumbnail(self):
from nesh.thumbnails import *
if self.image:
make_admin_thumbnails(self)
return '' % make_thumbnail(self.get_image_url(), 120)
admin_thumbnail.short_description = 'Thumbnail'
admin_thumbnail.allow_tags = True

it works but this approach got a little problem, when I remove the
object from the database, it doesn't delete the admin thumbnails.
because the way it rename the thumbnails when you set auto_rename =
True. It rename the thumbnails to --. but this is done in the pre_save signal so, when you are
going to save an object the first time, it doesn't have the primary
key number set yet and this had two implications:
1- If there is any object image in the path you are going to save this
image, this new image overwrite the old image.
2- due to the first immplication, if you delete and object with an
image, it will delete the image too, but this image is shared across
all objects added after the object being deleted. This is true for
objects of the same type (model).


2- Is there any way to add templates tags, filters or variables
dinamically to the templates of the admin interface, something like
this:

class TestModel(models.Model):
...
def do_something(self):
return '{{ "col name"|upper }}'
do_something.allow_tags = True
...
class Admin:
list_display = [...,'do_something'...]

-- 
Lic. José M. Rodriguez Bacallao
Cupet
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-

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



find a man at www.SexDatingPoint.com

2007-12-05 Thread Mr.Drum

find a man at www.SexDatingPoint.com
find a man looking for a woman at www.SexDatingPoint.com
meet adult male at www.SexDatingPoint.com
men seeking women at www.SexDatingPoint.com
women seeking men
www.SexDatingPoint.com
woman seeking man
www.SexDatingPoint.com
woman looking for man
www.SexDatingPoint.com
find a male looking for a female
www.SexDatingPoint.com
female seeking male
www.SexDatingPoint.com
female looking for male
www.SexDatingPoint.com
find a partner
www.SexDatingPoint.com
women searching for men
www.SexDatingPoint.com
woman searching for a man
www.SexDatingPoint.com
woman searching for men
www.SexDatingPoint.com
find a single man
www.SexDatingPoint.com
find single men
www.SexDatingPoint.com
search for single men
www.SexDatingPoint.com
find a groom
www.SexDatingPoint.com
search for a groom
www.SexDatingPoint.com
find a sex partner
www.SexDatingPoint.com
seek single male
www.SexDatingPoint.com
seek single men
www.SexDatingPoint.com
seek for men
www.SexDatingPoint.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: Order By Calculated Value??

2007-12-05 Thread RajeshD


>
> Hope that makes sense, as if I can do it this way instead of
> calculating it on the view, that would make this inclusion tag so much
> easier.

What does your Entry model look like?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



earn money

2007-12-05 Thread garfield084

In some pages give opportunities for earn money but all this page u
have to take e-mail and read them but with cashfiesta u dont have to
read e-mail so u download fiestabar program and setup it.It is little
fiesta bar on your desktop when u start it u have point u can save
1500 points in one day also more.Let earn money also sit your seat
100%quaranty
http://www.cashfiesta.com/php/join.php?ref=teo83

--~--~-~--~~~---~--~~
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: Problems saving values from SelectDateWidget

2007-12-05 Thread RajeshD



On Dec 5, 10:31 am, Stupid Dustbin <[EMAIL PROTECTED]>
wrote:
> Thanks for the reply. However, after updating to the latest SVN
> version of django. The same error still occurs. :(

I am using the same constructs with Django rev #6652 in production.
Perhaps you want to downgrade to that revision and try it out one more
time? If that fails, it would be time to open a ticket.

--~--~-~--~~~---~--~~
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: Dynamic class definitions

2007-12-05 Thread Marty Alchin

On Dec 5, 2007 12:25 PM, DeliciousPy <[EMAIL PROTECTED]> wrote:
> As for Marty's response...
> >However, I haven't looked at what it
> > would take to actually commit changes to the already-synced tables. I
> > have a feeling Django Evolution[2] will help with this, but I haven't
> > done any testing with it yet.
>
> Yeah, I've seen the DynamicModels writeup, but there is that issue of
> syncing modifications to models. Evolution might help, but as far as I
> can tell that will look at the models.py file, not database entries,
> so that brings me back to my original question of whether I should
> build some kind of script/app to edit models.py files.

A cursory look at the django-evolution source reveals what I expected:
it looks at the in-memory model class. Ordinarily, this will be
created by writing a model in models.py directly, but it's quite
possible to use database-backed model definitions and have them show
up in an app's 'models' module. Django evolution would then have no
way of knowing whether the model was written out by hand, or generated
dynamically.

I admit, I haven't done a thorough test of storing model definitions
in a database, but it really should work, and without having to
automatically build/edit your models.py file. Now that Django
Evolution is gaining traction, I may set up a separate Google Code
project just to create an app for managing dynamic models.

I don't know yet though, and I certainly wouldn't have it done in the
next few days or anything, so if you have more urgent need, feel free
to continue with it on your own. I'd be happy to answer any questions
you have about the process, to the best of my ability.

-Gul

--~--~-~--~~~---~--~~
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: View permission for models in the admin

2007-12-05 Thread James Bennett

On 12/5/07, Percy Rodriguez <[EMAIL PROTECTED]> wrote:
> Say one of this users has permissions to add/modify/delete model A and
> should only
> have a read view on model B. Are you suggesting this user should login
> into the admin
> site for working with model A and login again somewhere else in order
> to view the content
> on model B?

No, what's being said is that a user whose only permission is to
"read/view" shouldn't be going into the admin at all. That user is not
an administrator of that content. That user is not doing anything to
the content which requires the admin interface. So don't have that
user go to the admin interface to view that content.

Again: the Django admin is NOT DESIGNED for the idea of a user who has
only a "read/view content" permission. That's what, you know, the
*rest* of your site is for.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: View permission for models in the admin

2007-12-05 Thread Percy Rodriguez

On Dec 5, 12:26 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:

> You could try to adapt admin to do what you're asking, but I really think it
> would be easier to write your own views.  It's not so hard.

Ok, I'll write my own views but where? Outside of the admin?

Say one of this users has permissions to add/modify/delete model A and
should only
have a read view on model B. Are you suggesting this user should login
into the admin
site for working with model A and login again somewhere else in order
to view the content
on model B?

I'd like to be able to integrate this new, custom views into the admin
but have to figure out
which is the best way.

In the ideal scenario I would totally "simulate" the look and feel of
having a real "view permission":

- Model get listed properly in the main page
- Some sort of HTML table shows the full content of the record instead
of an editable html-form
- No modify / delete buttons get shown or they are inactive

Any ideas on how to get there?

Percy

--~--~-~--~~~---~--~~
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: Help debugging Django/MySQLdb exception

2007-12-05 Thread Karen Tracey
On 12/4/07, Brian Morton <[EMAIL PROTECTED]> wrote:
>
>
> I'm not sure what could be causing this problem.  This is a loader
> script that is loading a CSV and using the Django ORM to do lookups
> and inserts.  This is on a workstation with 1GB of memory running
> Ubuntu Gutsy (the MySQL server is local also).  I'm using MySQLdb
> 1.2.2 and there do not seem to be any relevant bugs fixed since then.
> Here is the traceback.
>
> Out of memory (Needed 8164 bytes)
> Traceback (most recent call last):
>   File "loader.py", line 66, in 
> food = Food.objects.get(nutrient_databank_number=row[0])


How big is what your are loading?  How long does it run before you hit the
out or memory error?  Are you running the script with a settings file that
has DEBUG set to True?  See:

http://code.djangoproject.com/ticket/3711

Karen

--~--~-~--~~~---~--~~
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: Issues trying to Caching a View

2007-12-05 Thread Matt

Alright... I think I might have tracked it down. I think it's an issue
with "Vary: Cookie" and it appears their is a fix for making this
header only show up when the request varies on the cookie.
http://code.djangoproject.com/ticket/3586

Haven't confirmed this yet, but seem like the issue.

Matt

On Dec 4, 10:58 am, Matt <[EMAIL PROTECTED]> wrote:
> Hi. I am trying to get a JS file cached by the browser using per-view
> caching with @cache_page and/or @cache_control. But the file is not
> getting cached as I would like.
>
> I have the following scenario: A view generates a JavaScript file that
> is unique for each user. However the JS file rarely changes for a
> user.
>
> In view.py---
> @cache_page(37000)
> @cache_control(private=True, max_age=37000)
> def user_unique_js(request):
> -
>
> When accessing the page using FireFox I can check out the HTTP headers
> and they look like the following:
> 
> HTTP/1.1 200 OK
> Date: Tue, 04 Dec 2007 14:59:43 GMT
> Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/
> 5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c
> Expires: Wed, 05 Dec 2007 01:16:23 GMT
> Vary: Cookie
> Last-Modified: Tue, 04 Dec 2007 14:59:43 GMT
> Etag: af0d1f45cb03ee198342ddb280f3164d
> Cache-Control: private, max-age=37000
> Content-Type: text/html; charset=utf-8
> -
>
> However, from looking at the cache using about:cache, it appears the
> JS file get reloaded each time the page is loaded.
>
>  From about:cache -
> last fetched: 2007-12-04 10:54:08
> last modified: 2007-12-04 10:54:04
> expires: 2007-12-04 20:16:23
> ---
>
> The static JS files served by Apache do get cached. Their headers look
> like the following:
> --
> HTTP/1.1 200 OK
> Date: Tue, 04 Dec 2007 14:58:27 GMT
> Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/
> 5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c
> Last-Modified: Mon, 03 Dec 2007 19:59:20 GMT
> Etag: "67bf-8136-37463600"
> Accept-Ranges: bytes
> Content-Length: 33078
> Content-Type: application/x-javascript
> --
>
>  From about:cache -
> last fetched: 2007-12-04 10:54:06
> last modified: 2007-12-04 10:52:48
> expires: 2007-12-04 11:52:21
> --
>
> Does anyone have an idea of what the issue could? Am I attempting to
> cache the file properly?
>
> Thanks,
> Matt
--~--~-~--~~~---~--~~
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: View permission for models in the admin

2007-12-05 Thread Karen Tracey
On 12/5/07, Percy Rodriguez <[EMAIL PROTECTED]> wrote:
>
>
> On Dec 5, 11:42 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > On 12/5/07, Percy Rodriguez <[EMAIL PROTECTED]> wrote:
>
> > and it doesn't include any view/read permissions.  The Django admin site
> > code assumes any User with "is_staff" set to True can view/read
> everything.
> > It only uses permissions to limit the ability to add and change objects.
>
> I have a few users with is_staff = True and they can't see any models
> they don't
> have explicit permissions for. I even tried to access other models and
> I get a
> "Permission denied" error.


Ah, I didn't know that.  Guess I misread the docs.

You could try to adapt admin to do what you're asking, but I really think it
would be easier to write your own views.  It's not so hard.

Karen

--~--~-~--~~~---~--~~
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: Dynamic class definitions

2007-12-05 Thread DeliciousPy

> From your description, I don't understand why your models need to be
> dynamic. If each Item is defined in terms of it's Type and Fields,
> then can you not change the definition on an Item by simply adding new
> ItemTypes and ItemFields?
If you're talking about using ItemField Classes, I could, but then
there would no real instances of items other than as a collection of
foreign keys, and instead my items are stored in instances of
different item field classes. and I get tables that consist of
instances of the various types of fields available (i.e. a table full
of charfields, which is holding all the data for all the charfields of
my items).

As for them needing to be dynamic, it's that I want end-users (who
wouldn't have access to models,py and the know-how to change it) to be
able to add fields to items, like "model" or "manufacturer", etc. to
fit their needs.

At my current job I use a CRM system that has all these unnecessary
fields for all kinds of records. It would be wonderful if the end-
users (say, accounting, or warehouse manager, or whatever) could put
in the fields as required (which we can do, but we can't get rid of
the default ones), so that anyone entering in a new instance of an
item could later fill out the fields.


As for Marty's response...
>However, I haven't looked at what it
> would take to actually commit changes to the already-synced tables. I
> have a feeling Django Evolution[2] will help with this, but I haven't
> done any testing with it yet.

Yeah, I've seen the DynamicModels writeup, but there is that issue of
syncing modifications to models. Evolution might help, but as far as I
can tell that will look at the models.py file, not database entries,
so that brings me back to my original question of whether I should
build some kind of script/app to edit models.py files.
Matt, the custom_model_fields link will probably come in handy.
Thanks!

-D. Py
--~--~-~--~~~---~--~~
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: View permission for models in the admin

2007-12-05 Thread James Bennett

On 12/5/07, Percy Rodriguez <[EMAIL PROTECTED]> wrote:
> I have a few users with is_staff = True and they can't see any models
> they don't
> have explicit permissions for. I even tried to access other models and
> I get a
> "Permission denied" error.

Giving any permission -- add, change or delete -- to a user for a
model lets the user "view" that model in the admin. Again: Django does
not have an explicit "view/read X" permission by default, because it
assumes that the admin app will only be available to trusted users who
actually administer the content. And someone who only views or reads
things is not, by definition, administering those things.


> I guess i'd try customize the admin anyway. In the documentation you
> pointed out
> custom permission creation is described. I guess I could  override the
> admin templates
> and and try to make use of this new permissions in order to get the
> desired effect.

Take Karen's advice. Trying to hack custom behavior into the admin
will take far, far, far longer than simply writing a few views of your
own to do what you want.

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: View permission for models in the admin

2007-12-05 Thread Percy Rodriguez

On Dec 5, 11:42 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On 12/5/07, Percy Rodriguez <[EMAIL PROTECTED]> wrote:

> and it doesn't include any view/read permissions.  The Django admin site
> code assumes any User with "is_staff" set to True can view/read everything.
> It only uses permissions to limit the ability to add and change objects.

I have a few users with is_staff = True and they can't see any models
they don't
have explicit permissions for. I even tried to access other models and
I get a
"Permission denied" error.

> Any ideas on how could I implement that in the cleanest possible way?
>
> This is not a way in which the admin site is meant to be
> extended/customized.  The admin site is meant for trusted users.  If you're
> looking to limit what certain users can see, I believe you should be
> developing your own custom views for this, not trying to make the admin site
> do it.

I guess i'd try customize the admin anyway. In the documentation you
pointed out
custom permission creation is described. I guess I could  override the
admin templates
and and try to make use of this new permissions in order to get the
desired effect.

More ideas anyone?

Percy.
--~--~-~--~~~---~--~~
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 Snippets-contact form

2007-12-05 Thread mike

Gul You hit the nail right on the head...thanks a bunch.

On Dec 5, 10:52 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> I doubt the problem is with base.html itself, but there might still be
> a mismatch of block names.
>
> contact.html is expecting the following blocks to be defined in base.html:
>
> * fulltitle
> * header
> * extrahead
> * content-wrap
>
> While thankyou.html is expecting the following blocks instead:
>
> * billboard
> * title
> * header
> * content
>
> My guess is that your base.html probably has "title" and "content" but
> not the rest of them. Try changing the contact.html so "fulltitle"
> becomes "title" and "content-wrap" becomes "content".
>
> -Gul
--~--~-~--~~~---~--~~
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: Help debugging Django/MySQLdb exception

2007-12-05 Thread Thejaswi Puthraya

> self.errorhandler(self, exc, value)
>   File "/var/lib/python-support/python2.5/MySQLdb/connections.py",
> line 35, in defaulterrorhandler
> raise errorclass, errorvalue
> _mysql_exceptions.InterfaceError: (0, '')

>From what I could make out from the PEP 249[1], you seem to have a
problem with MySqldb. Try reinstalling it and check if the error
persists.

[1] http://www.python.org/dev/peps/pep-0249/

Cheers
Thejaswi Puthraya
http://thejaswi.info/
--~--~-~--~~~---~--~~
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 Snippets-contact form

2007-12-05 Thread Marty Alchin

I doubt the problem is with base.html itself, but there might still be
a mismatch of block names.

contact.html is expecting the following blocks to be defined in base.html:

* fulltitle
* header
* extrahead
* content-wrap

While thankyou.html is expecting the following blocks instead:

* billboard
* title
* header
* content

My guess is that your base.html probably has "title" and "content" but
not the rest of them. Try changing the contact.html so "fulltitle"
becomes "title" and "content-wrap" becomes "content".

-Gul

--~--~-~--~~~---~--~~
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 Snippets-contact form

2007-12-05 Thread mike

if i include something like this at the top it will load the admin
media, but nothing will be below it

{% extends "admin/base_site.html" %}
{% block content %}
{% load adminmedia %}
{% endblock %}


On Dec 5, 10:42 am, mike <[EMAIL PROTECTED]> wrote:
> On Dec 5, 10:36 am, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
>
> > mike napisał(a):
>
> > > I have been trying to implement the contact form from the Django
> > > Snippets page found here.
>
> > >http://www.djangosnippets.org/snippets/261/I'm able to make it all
> > > work together, but the contacts.html page, is blank unless i remove
> > > the{% extends "base.html" %}  part.  After removing it I can see
> > > the input boxes, but the page is really ugly.   Anyone know why
> > > importing this template erases everything below it? any help would be
> > > appreciated.
>
> > Possibly it does not have appropriate blocks or is just empty?
>
> no, the  {% extends "base.html" %}   line is also in the thankyou.html
> page and it works there, the text shows fine.
>
>
>
> > --
> > Jarek Zgoda
> > Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101
>
> > "We read Knuth so you don't have to." (Tim Peters)
--~--~-~--~~~---~--~~
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: modelling and multiple fields as primary key

2007-12-05 Thread mtrier

Override the save method in the model.  Do the lookup and set the
status accordingly.  Am I missing something?

Michael Trier
blog.michaeltrier.com

On Dec 5, 8:26 am, turbofart <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to model a simple application. It will consist of 2 models:
>
> - document
>client_number
>document_number
>document_date
>... (some additional fields)
>
> - document_status
>client_number
>document_number
>document_date
>
>status_code
>comment
>... (some additional fields)
>
> I am aware, that django will not allow me to create primary key on
> multiple fields (client_number, document_number, document_date), and
> will create for each model (table) it's surogate id field as primary
> key, I'm OK with that.
>
> What I would like to achieve, is to add document status, that just
> before inserting into db, will find it's parent document's primary
> key, by searching in database for those 3 fields (client_number,
> document_number, document_date).
>
> Could you please help me, or at least point the direction I should
> follow?
>
> Best regards,
>
> --
> turbofart
--~--~-~--~~~---~--~~
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 Snippets-contact form

2007-12-05 Thread mike



On Dec 5, 10:36 am, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> mike napisał(a):
>
> > I have been trying to implement the contact form from the Django
> > Snippets page found here.
>
> >http://www.djangosnippets.org/snippets/261/ I'm able to make it all
> > work together, but the contacts.html page, is blank unless i remove
> > the{% extends "base.html" %}  part.  After removing it I can see
> > the input boxes, but the page is really ugly.   Anyone know why
> > importing this template erases everything below it? any help would be
> > appreciated.
>
> Possibly it does not have appropriate blocks or is just empty?


no, the  {% extends "base.html" %}   line is also in the thankyou.html
page and it works there, the text shows fine.
>
> --
> Jarek Zgoda
> Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101
>
> "We read Knuth so you don't have to." (Tim Peters)
--~--~-~--~~~---~--~~
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: View permission for models in the admin

2007-12-05 Thread Karen Tracey
On 12/5/07, Percy Rodriguez <[EMAIL PROTECTED]> wrote:
>
>
> Hi everyone,
>
> I'm quite new to Django but so far I'm making progress using and
> customizing the admin interface. Last nite I realized there is no view
> or read only permission on models, the closest thing I found was "Can
> change permission".


Right.  The admin site's use of permissions is described here:

http://www.djangoproject.com/documentation/authentication/#permissions

and it doesn't include any view/read permissions.  The Django admin site
code assumes any User with "is_staff" set to True can view/read everything.
It only uses permissions to limit the ability to add and change objects.

Any ideas on how could I implement that in the cleanest possible way?


This is not a way in which the admin site is meant to be
extended/customized.  The admin site is meant for trusted users.  If you're
looking to limit what certain users can see, I believe you should be
developing your own custom views for this, not trying to make the admin site
do it.

Karen

--~--~-~--~~~---~--~~
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 Snippets-contact form

2007-12-05 Thread Jarek Zgoda

mike napisał(a):
> I have been trying to implement the contact form from the Django
> Snippets page found here.
> 
> http://www.djangosnippets.org/snippets/261/  I'm able to make it all
> work together, but the contacts.html page, is blank unless i remove
> the{% extends "base.html" %}  part.  After removing it I can see
> the input boxes, but the page is really ugly.   Anyone know why
> importing this template erases everything below it? any help would be
> appreciated.

Possibly it does not have appropriate blocks or is just empty?

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

--~--~-~--~~~---~--~~
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 Snippets-contact form

2007-12-05 Thread mike

Here is the contacts.html page


{% extends "base.html" %}

{% block fulltitle %}Contact me!{% block title %}{% endblock %}{%
endblock %}

{% block header %}
 header of course
{% endblock %}

{% block extrahead %}
{% endblock %}

{% block content-wrap %}








Name:

Email:



Message:




http://path/to/
submitbutton.png"
onclick="YY_checkform('theform','name','#q','0','Field \'name\' is
empty.','Email','#S','2','Field \'Email\' appears not to be
valid.','message','2','1','Field \'message\' is empty.');return
document.MM_returnValue" />









{% endblock %}


### thankyou.html #

On Dec 5, 10:32 am, mike <[EMAIL PROTECTED]> wrote:
> I have been trying to implement the contact form from the Django
> Snippets page found here.
>
> http://www.djangosnippets.org/snippets/261/ I'm able to make it all
> work together, but the contacts.html page, is blank unless i remove
> the{% extends "base.html" %}  part.  After removing it I can see
> the input boxes, but the page is really ugly.   Anyone know why
> importing this template erases everything below it? any help would be
> appreciated.
--~--~-~--~~~---~--~~
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 Snippets-contact form

2007-12-05 Thread mike

I have been trying to implement the contact form from the Django
Snippets page found here.

http://www.djangosnippets.org/snippets/261/  I'm able to make it all
work together, but the contacts.html page, is blank unless i remove
the{% extends "base.html" %}  part.  After removing it I can see
the input boxes, but the page is really ugly.   Anyone know why
importing this template erases everything below it? any help would be
appreciated.
--~--~-~--~~~---~--~~
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: Mod_Python Error - ImproperlyConfigured: Error loading psycopg module: No module named psycopg

2007-12-05 Thread Karen Tracey
On 12/5/07, AY <[EMAIL PROTECTED]> wrote:
>
>
> Good Morning, Thanks for reply my request! Can you show me where/how
> to detect the error in psycopg module and how to fix the problem. I
> have completed the following steps without any problem. (1) install
> Python 2.5.1 windows installer (Python 2.5.1.exe) (2) install
> TortoiseSVN-1.4.5.10425-win-svn-1.4.5.msi (3) Install Django 0.96 (4)
> Update path variables to include python path (C:\python25; C:
> \python25\tools\scripts;c:\python25\scripts) (5) install apache2.2.4-
> win32-x86-no_ssl_msi web server (6)Install mod_python-3.3.1win-py2.5-
> apache2.2.exe to allow apache and python to talk to each other (7)
> install python memchache (python-memcache-1.39.tar.gz (8) download
> FacBackOpac.
> However I got stuck at (9) configure apache to use facbackopac
> directory as a django project. This is my FIRST try to apply Django on
> opac and have no idea to solve this mod_python error. Any help will be
> very appreciated.  Thanks!


The list of instructions you are following don't appear to have included the
piece that lets Django use Python to access the database, that's what
psycopg does.  See:

http://www.djangoproject.com/documentation/install/#get-your-database-running

for pointers on where to get psycopg.

(Nor do I see in the list so far the database itself, which you will also
need.  But I'm unfamiliar with facbackopac.  From a quick look at its Google
groups page it sounds like it provides an alternative interface to an
existing catalog, so I guess maybe you already have a database with this
catalog running?)

Karen

--~--~-~--~~~---~--~~
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: Problem with the django tutorial

2007-12-05 Thread andy baxter

I thought I had - in fact I'm pretty sure I remember doing it, but when 
I looked it wasn't there, so thanks for this. It's now working OK.

andy

ChaosKCW wrote:
> Hi
>
> It works for me,
>
> Did you add your application to the settings.py as per a previous
> step ?
>
> On Dec 5, 3:36 pm, andy baxter <[EMAIL PROTECTED]>
> wrote:
>   
>> Hello,
>>
>> I've been working my way through the django tutorial. I'm really
>> impressed with what django can do, but I've hit a problem - I'm now on
>> the part of part 2 of the tutorial where it says to add the following
>> lines to your mysite/polls/models.py:
>>
>> class Poll(models.Model):
>> # ...
>> class Admin:
>> pass
>>
>> This is supposed to bring the Poll class into the admin interface, but
>> on my system it isn't working - nothing changes on the admin page, even
>> when I refresh the page or restart the server.
>>
>> Can anyone help with this?
>>
>> andy baxter.
>> 
> >
>
>   


--~--~-~--~~~---~--~~
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: Problem with the django tutorial

2007-12-05 Thread ChaosKCW

Hi

It works for me,

Did you add your application to the settings.py as per a previous
step ?

On Dec 5, 3:36 pm, andy baxter <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> I've been working my way through the django tutorial. I'm really
> impressed with what django can do, but I've hit a problem - I'm now on
> the part of part 2 of the tutorial where it says to add the following
> lines to your mysite/polls/models.py:
>
> class Poll(models.Model):
> # ...
> class Admin:
> pass
>
> This is supposed to bring the Poll class into the admin interface, but
> on my system it isn't working - nothing changes on the admin page, even
> when I refresh the page or restart the server.
>
> Can anyone help with this?
>
> andy baxter.
--~--~-~--~~~---~--~~
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: Dynamic class definitions

2007-12-05 Thread Matt

> I want to be able to change the definition of an existing class (and
> the associated parts of the DB)  during runtime, from a web interface.

> I'll describe the model I want to implement...
> Say I have three classes: Item, Item Type, (and possibly) Item Field

>From your description, I don't understand why your models need to be
dynamic. If each Item is defined in terms of it's Type and Fields,
then can you not change the definition on an Item by simply adding new
ItemTypes and ItemFields?

> Another requirement is the ability to have "complex fields" that is,
> small collections of fields that go together, like a boolean field
> (represented by a checkbox) used to specify if a partner charfield
> should do one thing or another.

If the complexity exists at the data level, you may find that Django's
'custom model fields' [1] will help you with that.

Otherwise, if the complexity is just presentation/form-based, you can
use custom form fields/widgets. See James Bennett's excellent writeup
on newforms for more on that (and newforms in general) [2].

Matt.

[1] http://www.djangoproject.com/documentation/custom_model_fields/
[2] http://www.b-list.org/weblog/2007/nov/23/newforms/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



View permission for models in the admin

2007-12-05 Thread Percy Rodriguez

Hi everyone,

I'm quite new to Django but so far I'm making progress using and
customizing the admin interface. Last nite I realized there is no view
or read only permission on models, the closest thing I found was "Can
change permission".

Any ideas on how could I implement that in the cleanest possible way?

I'm using the regular django code from svn, not the newforms admin
branch.

Thanks a lot in advance,

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



Problem with the django tutorial

2007-12-05 Thread andy baxter

Hello,

I've been working my way through the django tutorial. I'm really 
impressed with what django can do, but I've hit a problem - I'm now on 
the part of part 2 of the tutorial where it says to add the following 
lines to your mysite/polls/models.py:

class Poll(models.Model):
# ...
class Admin:
pass


This is supposed to bring the Poll class into the admin interface, but 
on my system it isn't working - nothing changes on the admin page, even 
when I refresh the page or restart the server.

Can anyone help with this?

andy baxter.


--~--~-~--~~~---~--~~
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: Problems saving values from SelectDateWidget

2007-12-05 Thread Stupid Dustbin

Thanks for the reply. However, after updating to the latest SVN
version of django. The same error still occurs. :(

On Dec 1, 12:17 am, RajeshD <[EMAIL PROTECTED]> wrote:
> On Nov 29, 4:51 am, Stupid Dustbin <[EMAIL PROTECTED]>
> wrote:
>
> > Hi, encountered a problem recently withSelectDateWidget. I'm not very
> > sure what I did wrong.
>
> Your usage of that widget is correct.
>
> Note that a recent Django revision (the excellent "autoescape"
> feature) had introduced a bug that caused this widget to fail. It's
> been fixed in SVN rev. 6723:
>
> http://code.djangoproject.com/changeset/6723
--~--~-~--~~~---~--~~
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: Mod_Python Error - ImproperlyConfigured: Error loading psycopg module: No module named psycopg

2007-12-05 Thread AY

Good Morning, Thanks for reply my request! Can you show me where/how
to detect the error in psycopg module and how to fix the problem. I
have completed the following steps without any problem. (1) install
Python 2.5.1 windows installer (Python 2.5.1.exe) (2) install
TortoiseSVN-1.4.5.10425-win-svn-1.4.5.msi (3) Install Django 0.96 (4)
Update path variables to include python path (C:\python25; C:
\python25\tools\scripts;c:\python25\scripts) (5) install apache2.2.4-
win32-x86-no_ssl_msi web server (6)Install mod_python-3.3.1win-py2.5-
apache2.2.exe to allow apache and python to talk to each other (7)
install python memchache (python-memcache-1.39.tar.gz (8) download
FacBackOpac.
However I got stuck at (9) configure apache to use facbackopac
directory as a django project. This is my FIRST try to apply Django on
opac and have no idea to solve this mod_python error. Any help will be
very appreciated.  Thanks!



On Dec 4, 10:39 am, "Mauro Sánchez" <[EMAIL PROTECTED]> wrote:
> 2007/12/4, AY <[EMAIL PROTECTED]>:
>
> > Hi! I am trying to configure Apache to use facbackopan directory as a
> > django project, and have the following mod_python error message. Help
> > would be very appreciated. Thanks in advance!
>
> Hi.
>
> > 
> > MOD_PYTHON ERROR
>
> > ImproperlyConfigured: Error loading psycopg module: No module named
> > psycopg
>
> I think that you have an error in the psycopg module. Are you sure it
> is installed correctly? Can you use it outside django?
--~--~-~--~~~---~--~~
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: Order By Calculated Value??

2007-12-05 Thread Tane Piper

Yes, What I wanted to do was have a field in my Category model called
num_entries, and every time an Entry model was saved, I wanted to
increment this by one - but I could not work out how to access the
Category model to update just one field per entry (for example if my
entry is in Blog and Django, I want to update each
blog_categories.num_entries field for that row).

Hope that makes sense, as if I can do it this way instead of
calculating it on the view, that would make this inclusion tag so much
easier.

On Dec 5, 2007 3:02 PM, RajeshD <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> >
> > I'm wondering if there is any way possible to get this value in my
> > inclusion tag?
>
> You can use the "extra" method to bring in your entry counts into the
> query set. See the following for an example:
>
> http://www.djangoproject.com/documentation/db-api/#extra-select-none-where-none-params-none-tables-none
>
> > I had tried before to store this value in a field, but
> > couldn't get it to save, otherwise I would just pass in a field
> > 'num_entries' so if anyone can suggest anything, that would be great.
>
> Can you describe what you did that prevented you from saving the
> computed count?
>
> Another solution is to batch compute your counts using a shell script
> at some frequency. The script could iterate over each category and
> recompute its counts and store them.
>
> Yet another solution is to convert your cats queryset to a list, loop
> over it to get an entry count, and then sort the list in Python to
> pass on to your template.
>
> So there seem to be many ways to skin this cat.
>
> -Rajesh Dhawan
> >
>



-- 
Tane Piper
Blog - http://digitalspaghetti.me.uk
AJAX Pastebin - http://pastemonkey.org

This email is: [ ] blogable [ x ] ask first [ ] private

--~--~-~--~~~---~--~~
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: Another new Django site

2007-12-05 Thread [EMAIL PROTECTED]

Sometimes the small hint is the one that makes all the difference.

On Dec 4, 4:27 pm, John M <[EMAIL PROTECTED]> wrote:
> Wow, thanks for the compliment, but I hardly know django at all but
> did give you that one SMALL hint on your question I recall.
>
> Neat site, good luck with it.
>
> John
>
> On Dec 3, 11:18 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Many, many folks on this list helped me with many many things putting
> > this together, and I thank all of you.
> > Let me single out John M. and Tim Chase, for helping me figure out how
> > to get data from a dyno run and import it into the site. Makes for
> > some nifty graphs.
>
> >http://classicmotorsports.net
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Using Oracle support and Synonyms

2007-12-05 Thread ChaosKCW

Hi

Just a quick one, if you wish to keep your django instance data
seperate from your production data and still use all the nice nifty
ORM and admin interface, you can just add synonyms to your django
user, then make the following change from USER_TABLES to USER_OBJECTS
in the db code and it all appears to work:

file : Python25\Lib\site-packages\django\db\backends\oracle
\instrospection.py

def get_table_list(cursor):
"Returns a list of table names in the current database."
cursor.execute("SELECT OBJECT_NAME FROM USER_OBJECTS WHERE
OBJECT_TYPE IN ('TABLE', 'SYNONYM')")
return [row[0].upper() for row in cursor.fetchall()]


You cannot of course create tables this way, but it highly usefull for
using the admin interface on existing databases while keeping dango
seperate.

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



Re: ORA-00911: Invalid charatcer

2007-12-05 Thread ChaosKCW

Oracle is working brilliantly now based on my tests. This is a great
addition!



On Nov 30, 7:36 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On 11/30/07, Da Martian <[EMAIL PROTECTED]> wrote:
>
>
>
> > Aha, so there is a fix? Its just not in 0.96.1? That was indeed going to
> > be my very next question, as all the tickets say oracle is supported now and
> > should be working.
>
> > So if I pull the trunk this issue is resolved?
>
> > Thanks in advance!
>
> Yes, if you pull the trunk you'll get working Oracle support.
>
> Karen
--~--~-~--~~~---~--~~
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: Order By Calculated Value??

2007-12-05 Thread RajeshD

Hi,

>
> I'm wondering if there is any way possible to get this value in my
> inclusion tag?

You can use the "extra" method to bring in your entry counts into the
query set. See the following for an example:

http://www.djangoproject.com/documentation/db-api/#extra-select-none-where-none-params-none-tables-none

> I had tried before to store this value in a field, but
> couldn't get it to save, otherwise I would just pass in a field
> 'num_entries' so if anyone can suggest anything, that would be great.

Can you describe what you did that prevented you from saving the
computed count?

Another solution is to batch compute your counts using a shell script
at some frequency. The script could iterate over each category and
recompute its counts and store them.

Yet another solution is to convert your cats queryset to a list, loop
over it to get an entry count, and then sort the list in Python to
pass on to your template.

So there seem to be many ways to skin this cat.

-Rajesh Dhawan
--~--~-~--~~~---~--~~
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: create_object generic view exampe

2007-12-05 Thread Ryan K

Try the Django book 
http://www.djangobook.com/en/beta/chapter09/#s-create-update-delete-generic-views.

On Dec 5, 7:56 am, Florian Lindner <[EMAIL PROTECTED]> wrote:
> Hello,
> I'm looking for an example on how to use the
> django.views.generic.create_update.create_object generic view (with
> newforms).
>
> Can anyone point me to a good ressource?
>
> Thanks,
>
> Florian
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Microsoft Developer.

2007-12-05 Thread Klaire

Microsoft Developer.

http://www.freerealms.fr/microsoft

Job .
--~--~-~--~~~---~--~~
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: Initializing a selection (choice) field

2007-12-05 Thread Karen Tracey
On 12/5/07, Nader <[EMAIL PROTECTED]> wrote:
>
>
> Hallo
>
> I have two applications in a project. One of the the field in one
> application is a "choice" field. The content of this choice field has
> to be assigned by some attribute of other application's field. With an
> example it will be more clear to explain it.
>
> Two applications: A and B in a project (g2ps).
>
> In application A I have defined a model in which one filed is a
> choice:
>
> from nlscia.contactinfos.models import Contactinfo
>
> class Dataset(models.Model):
>..
>contactID = models.IntegerField(choices=[(f.contactID, '%s: %s, %s
> %s' %
> (f.contactID,
> f.givenName,f.surName,
>f.organizationName))
>  for f in
> Contactinfo.objects.all()])
>
>
> And in application B I have defined the "Contactinfo"
>
> class Contactinfo(models.Model):
> contactID = models.IntegerField(primary_key=True)
> givenName = models.CharField(unique=True, maxlength=100)
> surName = models.CharField(unique=True, maxlength=100)
> organizationName = models.CharField(maxlength=100)
> 
> ...
> 
>
> But what is actually the problem? If I change or add some information
> in one of the 'Contactinfo" field and back to other application to see
> this changing, I don't see any changing in 'choice' list in other
> model. Only I can see this changing if start again the server. Isn't
> it possible without any redesign of data model? I mean to redefine
> data model based on some relationship as 'Foreignkey' or 'ManytoMany'
> for example.


Note the code to build the choices list for your Dataset model ContactID
runs only once, when the Dataset model is imported.  That is why the choices
list does not get updated as you make additions to Contactinfo.  From the
docs here: http://www.djangoproject.com/documentation/model-api/#choices see
the paragraph:

Finally, note that choices can be any iterable object — not necessarily a
list or tuple. This lets you construct choices dynamically. But if you find
yourself hacking choices to be dynamic, you're probably better off using a
proper database table with a ForeignKey. choices is meant for static data
that doesn't change much, if ever.

Really, what you have described here is a ForeignKey -- why don't you want
to use that construct?

Karen

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



cache middleware and middlewareorder

2007-12-05 Thread Paul Rauch
hi list,

I got some Problems with the middlewareorder of cachemiddlerware,
since it does not seem possible to order it the right way.

>Put the CacheMiddleware before any other middleware that might add
>something to the Vary header (response middleware is applied in reverse
>order). The following middleware modules do so:
>
>* SessionMiddleware adds Cookie
>* GZipMiddleware adds Accept-Encoding
>* LocaleMiddleware adds Accept-Language

this is part of the documentation and seems easy to follow, but:

>The cache middleware caches every page that doesn’t have GET or POST
>parameters. Optionally, if the CACHE_MIDDLEWARE_ANONYMOUS_ONLY setting
>is True, only anonymous requests (i.e., not those made by a logged-in
>user) will be cached. This is a simple and effective way of disabling
>caching for any user-specific pages (include Django’s admin interface).
>Note that if you use CACHE_MIDDLEWARE_ANONYMOUS_ONLY, you should make
>sure you’ve activated AuthenticationMiddleware and that
>AuthenticationMiddleware appears before CacheMiddleware in your
>MIDDLEWARE_CLASSES.

now problem is, that authentication middleware must have
sessionmiddleware before itself. else django fails to start:

>AssertionError: The Django authentication middleware requires session
>middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to
>insert 'django.contrib.sessions.middleware.SessionMiddleware'.

If I try to get authenticationmiddleware after cachemiddleware I get
another error:

>AssertionError: The Django cache middleware with
>CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True requires authentication
>middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to
>insert 'django.contrib.auth.middleware.AuthenticationMiddleware'
>before the CacheMiddleware.


the only way to get a working djangoinstance is to put
sessionmiddleware _before_ cachemiddleware, what you shouldn't do
according to the docs.

is this a mistake in the docs or an error in django?

greetz Paul Rauch


signature.asc
Description: PGP signature


Re: Installing Django on VPS with 128mb ram

2007-12-05 Thread walterbyrd



On Dec 4, 8:53 pm, "Chris Moffitt" <[EMAIL PROTECTED]> wrote:
> On my blog post here 
> -http://www.satchmoproject.com/blog/2007/sep/25/optimizing-django-vps-...
>
> I wrote some of my tips for configuring MySQL to use less memory.  I also
> have some general thoughts on vps setup for django apps.
>
> HTH,
> Chris

Thanks Chris, I will have to give that a try.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



**Amazing New Google Site for Today's Information**

2007-12-05 Thread supremestar


**Click this and u will surely the fun and u will get the information
whatever u need today**

http://indianfriendfinder.com/go/g906183-pmem

http://www.freewebs.com/rajujaya/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



modelling and multiple fields as primary key

2007-12-05 Thread turbofart

Hi,

I'm trying to model a simple application. It will consist of 2 models:

- document
   client_number
   document_number
   document_date
   ... (some additional fields)


- document_status
   client_number
   document_number
   document_date

   status_code
   comment
   ... (some additional fields)


I am aware, that django will not allow me to create primary key on
multiple fields (client_number, document_number, document_date), and
will create for each model (table) it's surogate id field as primary
key, I'm OK with that.

What I would like to achieve, is to add document status, that just
before inserting into db, will find it's parent document's primary
key, by searching in database for those 3 fields (client_number,
document_number, document_date).

Could you please help me, or at least point the direction I should
follow?

Best regards,

--
turbofart

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



Order By Calculated Value??

2007-12-05 Thread Tane Piper

Hi there,

At the moment, i'm building a inclusion tag for using on my blog
software to show all the categories, kind of like how Wordpress does
it.  The tag works fine and displays the data, sorted in order of the
name:

@register.inclusion_tag("blog/category_list.html")
def category_list(order="name"):
cats = Category.objects.all().order_by(order)
return {'categories': cats}

However what I'd like to do is also be able to order by the number of
entries associated with this category, so it's weight based rather
than alphabetical.

My Entry model has a ManyToManyField linked with categories, and my
Category model doesn't store this number, but for example it
calculates the value for the admin in a num_entries function:

class Category(models.Model):
""" A Category is a way to manage the taxonomy of the site"""
name=models.CharField(max_length=50) #The name of the category
description=models.TextField()
slug=models.CharField(max_length=75, null=True, blank=True)
active=models.BooleanField()
generate_feed=models.BooleanField()
parent=models.ForeignKey('self', null=True, blank=True)
.
def num_entries(self):
"""Returns the number of entries in this category"""
return self.entry_set.count()
num_entries.short_description = "Number of Entries"

I'm wondering if there is any way possible to get this value in my
inclusion tag?  I had tried before to store this value in a field, but
couldn't get it to save, otherwise I would just pass in a field
'num_entries' so if anyone can suggest anything, that would be great.

Thanks,

-- 
Tane Piper
Blog - http://digitalspaghetti.me.uk
AJAX Pastebin - http://pastemonkey.org

This email is: [ ] blogable [ x ] ask first [ ] private

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



create_object generic view exampe

2007-12-05 Thread Florian Lindner

Hello,
I'm looking for an example on how to use the  
django.views.generic.create_update.create_object generic view (with  
newforms).

Can anyone point me to a good ressource?

Thanks,

Florian

--~--~-~--~~~---~--~~
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: Custom template tag and filters in resolve_variable

2007-12-05 Thread Michal Ludvig

Rune Bromer wrote:
> On Dec 5, 2007, at 11:59 AM, Michal Ludvig wrote:
> 
>> Hi all,
>>
>> for the project I'm working on I needed to create a custom template  
>> tag,
>> call it 'mytag'.
>>
>> If I use it as {% mytag something %} everything goes fine (where
>> 'something' is a string passed to the template).
>> However I can't add any filters to that 'something'. As soon as I do:
>> {% mytag something|upper %}
>> I get an exception:
>>  VariableDoesNotExist at /test/
>>  Failed lookup for key [something|upper]
>>
>> That leads to a code in MytagNode.render() method:
>>  actual_message = resolve_variable(self.message, context)
>> where self.message is the argument passed to the macro, in this case
>> it's a string 'something|upper'.
>>
>> Is there an easy way to run all the attached filters in MytagNode?
> 
> Look at the "filter" templatetag [1]. You must do something like
> 
> {% filter upper %} {% mytag something %} {% endfilter %}

That seems to run the whole output of mytag through the filter. I just
need the parameter itself filtered. In reality mytag gets two arguments,
'label' and 'value' and spits out a few lines of HTML. It displays some
user profile information. The value of each property may need to be
filtered differently, e.g. if it's a dollar amount I want to attach my
filter '|dollarformat' that turns an integer like 1000 to a more
readable "$1,000". For other properties I may want other filters. In any
case I only need to filter the argument, not the tag output.

I could probably do something like message.split("|") and run the
filters (if any) manually. That is, import them from
django.template.defaultfilters and pass the output of resolve_variable
through them. But what if the filter in question is imported from a
non-default tag library? How do I find what to import then?

BTW Wouldn't it be more user-friendly to resolve the variable and run
all the filters yet before the custom tag gets called?

Michal




--~--~-~--~~~---~--~~
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: Dynamic class definitions

2007-12-05 Thread Marty Alchin

You might take a look at my writeup on dynamic models,[1] which
specifically covers a way to specify Django models in a database,
which can be changed at run-time. However, I haven't looked at what it
would take to actually commit changes to the already-synced tables. I
have a feeling Django Evolution[2] will help with this, but I haven't
done any testing with it yet.

-Gul

[1] http://code.djangoproject.com/wiki/DynamicModels
[2] http://code.google.com/p/django-evolution/

On 12/5/07, DeliciousPy <[EMAIL PROTECTED]> wrote:
>
> I'm thinking of trying to start making a CRM/ERP system, I had just
> started working on an inventory app, when I ran into a problem.
>
> I want to be able to change the definition of an existing class (and
> the associated parts of the DB)  during runtime, from a web interface.
>
>
> I'll describe the model I want to implement...
> Say I have three classes: Item, Item Type, (and possibly) Item Field
>
> Items would consist of an item type, and item fields (separate from
> the so-named classes)
>
> Item types would specify groups of item fields shown in item records
> (instances of the item class), and would also specify how the fields
> interacted with other parts of the database (ie accounting, sales,
> etc)
>
> Item fields would consists of a field name, a field type and a
> description of the field. This class might not be necessary, depending
> on how this would be implemented.
>
> Another requirement is the ability to have "complex fields" that is,
> small collections of fields that go together, like a boolean field
> (represented by a checkbox) used to specify if a partner charfield
> should do one thing or another.
>
>
> One way I was thinking of doing this would involve a view that would
> invoke a script that writes django code to do the dirty work of
> inserting stuff into models.py files and updating the db
> appropriately. I feel like there might be a better way, or perhaps
> something that does this already...
>
>
> So my questions are:
>
> Are there currently any existing methods of doing this kind of thing
> with Django (or something built for this purpose), and if not, what
> are your thoughts on how I should proceed?
> >
>

--~--~-~--~~~---~--~~
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: Custom template tag and filters in resolve_variable

2007-12-05 Thread Rune Bromer

On Dec 5, 2007, at 11:59 AM, Michal Ludvig wrote:

> Hi all,
>
> for the project I'm working on I needed to create a custom template  
> tag,
> call it 'mytag'.
>
> If I use it as {% mytag something %} everything goes fine (where
> 'something' is a string passed to the template).
> However I can't add any filters to that 'something'. As soon as I do:
> {% mytag something|upper %}
> I get an exception:
>   VariableDoesNotExist at /test/
>   Failed lookup for key [something|upper]
>
> That leads to a code in MytagNode.render() method:
>   actual_message = resolve_variable(self.message, context)
> where self.message is the argument passed to the macro, in this case
> it's a string 'something|upper'.
>
> Is there an easy way to run all the attached filters in MytagNode?

Look at the "filter" templatetag [1]. You must do something like

{% filter upper %} {% mytag something %} {% endfilter %}

[1] http://www.djangoproject.com/documentation/templates/#filter

-- 
Rune Bromer
Coniuro ApS
Tlf: +45 60 64 59 83
Email: [EMAIL PROTECTED]








--~--~-~--~~~---~--~~
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: Problems loading fixtures using loaddata

2007-12-05 Thread Divan Roulant

Thanks Russell for responding. I'm sorry for replying so late.

I have no longer problems with foreign keys. I can't tell what was the
problem but outputing fixtures for each model (one file per model
instead of one file for all models) don't get me the error anymore.
However, I still have problem with loading image files. Here's what I
get:

Loading 'initial_data' fixtures...
Installing xml fixture 'initial_data' from 'C:\workspace\apparto\..
\apparto\contact\fixtures'.
Installing xml fixture 'initial_data' from 'C:\workspace\apparto\..
\apparto\building\fixtures'.
Problem installing fixture 'C:\workspace
\apparto\..\apparto\building\fixtures\initial_data.xml': [Error 3] The
system ca
nnot find the path specified: u'/static/photos/2007/11/28'

What is strange is that for one model defined in "building", images
load correctly whereas for another model, it doesn't, even if for both
models, images path is under the same root (/static/photos/). I tried
to put all the pictures in the same folder but surprisingly, I get the
same behavior: images are found for a model but the path is not for
the other model!

I guess it's not much information, but maybe it is enough for you to
point me in the right direction.

Thanks!

Divan

On Nov 29, 8:48 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Nov 27, 2007 8:12 PM, Divan Roulant <[EMAIL PROTECTED]> wrote:
>
>
>
> > For those of you who are using loaddata, should loaddata be as
> > straighforward as to dumpdata and then load it (after cleaning the
> > database) or are there other steps in between that I am missing?
>
> It should be straightforward, and we have a fairly comprehensive suite
> of unit tests to support this assertion. I am particularly suprised
> that you are having problems with foreign keys - they are one area
> that I know is extensively tested.
>
> However, we're not perfect, so you may have found a problem. If you
> can provide a specific example of a failure, we can investigate
> further.
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



WEAK HEARTED DO NOT OPEN?????????ITS ABOUT UR?????????

2007-12-05 Thread nicky

WEAK HEARTED DO NOT OPEN?ITS ABOUT UR?
http://cloroo.blogspot.com/
http://closoo.blogspot.com/
http://chroos.blogspot.com/
http://dirido.blogspot.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
-~--~~~~--~~--~--~---



Custom template tag and filters in resolve_variable

2007-12-05 Thread Michal Ludvig

Hi all,

for the project I'm working on I needed to create a custom template tag,
call it 'mytag'.

If I use it as {% mytag something %} everything goes fine (where
'something' is a string passed to the template).
However I can't add any filters to that 'something'. As soon as I do:
{% mytag something|upper %}
I get an exception:
VariableDoesNotExist at /test/
Failed lookup for key [something|upper]

That leads to a code in MytagNode.render() method:
actual_message = resolve_variable(self.message, context)
where self.message is the argument passed to the macro, in this case
it's a string 'something|upper'.

Is there an easy way to run all the attached filters in MytagNode?

Thanks!

Michal

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



Initializing a selection (choice) field

2007-12-05 Thread Nader

Hallo

I have two applications in a project. One of the the field in one
application is a "choice" field. The content of this choice field has
to be assigned by some attribute of other application's field. With an
example it will be more clear to explain it.

Two applications: A and B in a project (g2ps).

In application A I have defined a model in which one filed is a
choice:

from nlscia.contactinfos.models import Contactinfo

class Dataset(models.Model):
   ..
   contactID = models.IntegerField(choices=[(f.contactID, '%s: %s, %s
%s' %
(f.contactID,
f.givenName,f.surName,
   f.organizationName))
 for f in
Contactinfo.objects.all()])
   

And in application B I have defined the "Contactinfo"

class Contactinfo(models.Model):
contactID = models.IntegerField(primary_key=True)
givenName = models.CharField(unique=True, maxlength=100)
surName = models.CharField(unique=True, maxlength=100)
organizationName = models.CharField(maxlength=100)

...


But what is actually the problem? If I change or add some information
in one of the 'Contactinfo" field and back to other application to see
this changing, I don't see any changing in 'choice' list in other
model. Only I can see this changing if start again the server. Isn't
it possible without any redesign of data model? I mean to redefine
data model based on some relationship as 'Foreignkey' or 'ManytoMany'
for example.


Cheers,
Nader
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---