Re: Admin interface

2007-03-08 Thread Aidas Bendoraitis

Either override templates for specific models or use javascript (js
property of the Admin class) to change the fields.
I think that it will be also possible to change the field type with
the newforms admin. Reference:
http://www.djangosnippets.org/snippets/35/

Good luck!
Aidas Bendoraitis [aka Archatas]

On 3/8/07, Arafel <[EMAIL PROTECTED]> wrote:
>
> Hello all,
>
> Is there a way to change the entry fields in the admin site? for
> example how do i change a field to a entry/text box like the one i'm
> typing in now rather than a text entry field?
>
> Thanks.
>
>
> >
>

--~--~-~--~~~---~--~~
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 installation on dreamhost

2007-03-08 Thread Equerm

chasfs skreiv:
> Can you set up your env so it it matches what fcgi has and then run
> manage.py shell?  If that works, use the shell to try to access the
> database.  The other thing that might help is to look at the logs,
> likely in ~/logs/django.gigzor.com.
>
> Thanks,
> -chasfs
> http://zdecisions.com

I checked the logs and found this:
FastCGI: comm with (dynamic) server "/home/USER/django.gigzor.com/
dispatch.fcgi" aborted:
FastCGI: incomplete headers (0 bytes) received from server "/home/USER/
django.gigzor.com/dispatch.fcgi"

It dosen't help me much, cause i am a total newbie at this =P


--~--~-~--~~~---~--~~
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 installation on dreamhost

2007-03-08 Thread Equerm

gordyt skreiv:
> Howdy Equerm,
>
> I have some notes posted on using Django with Dreamhost here:
>
> http://www.gordontillman.info/Development/DjangoDreamhost
>
> --gordy

Thanks, I'll check it out :)


--~--~-~--~~~---~--~~
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: Templatedb problem

2007-03-08 Thread Mary

Dear Malcom ;
I have renamed my version to "myapp.savedtemplate" and it worked fine
with me
so my problem has been solved and i really appreciate your help;

Thank you very much ;
Mary Adel

On Mar 7, 1:00 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2007-03-07 at 01:41 -0800, Mary wrote:
> > Dear Malcom;
>
> > I have commented this line #from template.models import Template
> > in template/loaders/database.py
>
> > and it works fine with but i don't know if it will affect any of the
> > functionality or not
>
> That's not a good idea. It will break a lot of things having to do with
> templating.
>
>
>
> > also my setting.py is :
> > TEMPLATE_LOADERS = (
> > 'django.template.loaders.filesystem.load_template_source',
> > 'django.template.loaders.app_directories.load_template_source',
> > 'myapp.template.loaders.database.load_template_source',
>
> > )
>
> > MIDDLEWARE_CLASSES = (
> > 'django.middleware.common.CommonMiddleware',
> > 'django.contrib.sessions.middleware.SessionMiddleware',
> > 'django.contrib.auth.middleware.AuthenticationMiddleware',
> > 'django.middleware.doc.XViewMiddleware',
> > "myapp.middleware.threadlocals.ThreadLocals",
> > )
>
> > ROOT_URLCONF = 'myapp.urls'
>
> > TEMPLATE_DIRS = (
> > # Put strings here, like "/home/html/django_templates".
> > # Always use forward slashes, even on Windows.
> > "/var/www/myapp/Template_Dir/",
> > )
>
> > INSTALLED_APPS = (
> > 'django.contrib.auth',
> > 'django.contrib.contenttypes',
> > 'django.contrib.sessions',
> > 'django.contrib.sites',
> > 'django.contrib.admin',
> > 'django.contrib.markup',
> > '.myapp.articles',
>
> This line looks a little suspicious (the leading '.'), but it may be
> fine.
>
> > 'myapp.stockphoto',
> > 'myapp.template',
>
> This is probably where your problem lies. From your error message, it
> looks like there is some confusion between your package called
> "template" and Django's internal "template" package. Try renaming your
> version to "myapp.templateX" or something like that and see if the
> problem goes away.
>
> I realise this is a bit ugly if it is the solution, but some of the
> dynamic importing inside Django can cause problems sometimes. If
> renaming here does make your problem go away, let us know, because it
> might be something we can look at fixing in the future. (And, obviously,
> if that doesn't fix the problem, let us know too and somebody might have
> some other ideas.)
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
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: Video uploading and converting - queue system?

2007-03-08 Thread Henrik Lied

The thing is that the server load will increase quite a bit when 500
users do the same thing at the same time. It would be nice to get a
different server to take care of this.

How's that "large streaming upload" patch working?


--~--~-~--~~~---~--~~
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: Testing and error handling

2007-03-08 Thread Lawrence Oluyede

> Can you provide a few more clues, please? In particular, what exception
> is being raised. If we know what part of the code is involved, it will
> be easier to try and work out the differences.
> If you can reduce the behaviour to a simple (only a few lines) example,
> that would be great, too.

I tried to slim down to a simple example. The same codebase makes the
test pass with OSX and Python 2.5, 2.4 and 2.3.
I copied in a Linux box and I get the right errors from Django (first
the lack of the 500.html template and then after creating it the test
fails because the view raises an exception).

I uploaded the demo app here: http://www.oluyede.org/temp/demo.tar.gz

HTH


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



myghtyboard forum problem

2007-03-08 Thread zehi

Hi,

I downloaded diamanda fro google.code and followed instructions at:
http://diamanda.googlecode.com/svn/trunk/README.TXT

Everything works just fine, I have anly problem with 'Add Forum'.

I am getting the following error message:

IntegrityError at /admin/myghtyboard/forum/add/
myghtyboard_forum.forum_topics may not be NULL
Request Method: POST
Request URL:http://127.0.0.1:8000/admin/myghtyboard/forum/add/
Exception Type: IntegrityError
Exception Value:myghtyboard_forum.forum_topics may not be NULL
Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/
lib/python2.5/site-packages/django/db/backends/sqlite3/base.py in
execute, line 92

The question is: what couse the problem?

Thank you.


--~--~-~--~~~---~--~~
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: Templatedb problem

2007-03-08 Thread Mary

I just have another one issue about the template db
I have created a template in the database and i called it blog/
home.html

and i wrote may view like this :

from django.shortcuts import render_to_response
from blog.home.models import Blog
def home(request):

return render_to_response('blog/home.html')

But i got an error which is
Exception Type: TemplateDoesNotExist
Exception Value:/blog/home.html
Exception Location: /usr/lib/python2.4/site-packages/Django-0.95.1-
py2.4.egg/django/template/loader.py in find_template_source, line 72
Template-loader postmortem

Django tried loading these templates, in this order:

* Using loader
django.template.loaders.filesystem.load_template_source:
  o /blog/home.html (File does not exist)
* Using loader
django.template.loaders.app_directories.load_template_source:
  o /blog/home.html (File does not exist)
  o /blog/home.html (File does not exist)
* Using loader
blog.savedtemplate.loaders.database.load_template_source:

Can anyone tell me please what is my mistake as i really can't know
Thank you very much
Mary Adel

On Mar 8, 11:49 am, "Mary" <[EMAIL PROTECTED]> wrote:
> Dear Malcom ;
> I have renamed my version to "myapp.savedtemplate" and it worked fine
> with me
> so my problem has been solved and i really appreciate your help;
>
> Thank you very much ;
> Mary Adel
>
> On Mar 7, 1:00 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Wed, 2007-03-07 at 01:41 -0800, Mary wrote:
> > > Dear Malcom;
>
> > > I have commented this line #from template.models import Template
> > > in template/loaders/database.py
>
> > > and it works fine with but i don't know if it will affect any of the
> > > functionality or not
>
> > That's not a good idea. It will break a lot of things having to do with
> > templating.
>
> > > also my setting.py is :
> > > TEMPLATE_LOADERS = (
> > > 'django.template.loaders.filesystem.load_template_source',
> > > 'django.template.loaders.app_directories.load_template_source',
> > > 'myapp.template.loaders.database.load_template_source',
>
> > > )
>
> > > MIDDLEWARE_CLASSES = (
> > > 'django.middleware.common.CommonMiddleware',
> > > 'django.contrib.sessions.middleware.SessionMiddleware',
> > > 'django.contrib.auth.middleware.AuthenticationMiddleware',
> > > 'django.middleware.doc.XViewMiddleware',
> > > "myapp.middleware.threadlocals.ThreadLocals",
> > > )
>
> > > ROOT_URLCONF = 'myapp.urls'
>
> > > TEMPLATE_DIRS = (
> > > # Put strings here, like "/home/html/django_templates".
> > > # Always use forward slashes, even on Windows.
> > > "/var/www/myapp/Template_Dir/",
> > > )
>
> > > INSTALLED_APPS = (
> > > 'django.contrib.auth',
> > > 'django.contrib.contenttypes',
> > > 'django.contrib.sessions',
> > > 'django.contrib.sites',
> > > 'django.contrib.admin',
> > > 'django.contrib.markup',
> > > '.myapp.articles',
>
> > This line looks a little suspicious (the leading '.'), but it may be
> > fine.
>
> > > 'myapp.stockphoto',
> > > 'myapp.template',
>
> > This is probably where your problem lies. From your error message, it
> > looks like there is some confusion between your package called
> > "template" and Django's internal "template" package. Try renaming your
> > version to "myapp.templateX" or something like that and see if the
> > problem goes away.
>
> > I realise this is a bit ugly if it is the solution, but some of the
> > dynamic importing inside Django can cause problems sometimes. If
> > renaming here does make your problem go away, let us know, because it
> > might be something we can look at fixing in the future. (And, obviously,
> > if that doesn't fix the problem, let us know too and somebody might have
> > some other ideas.)
>
> > Regards,
> > Malcolm


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



Template Tags

2007-03-08 Thread Merric Mercer

I have a template that loops through a simple query set and displays the 
data in a table.

I now need to add another column to my table.  However,  the data in the 
new column is a calculation based on two of the other fields
in that record.   

I presume that this can be done using a template tag, but I can't work 
out how it can be done.  I can't see how I can pass the values of the 
other fields into
a tag.  Can anybody please advise the best way to do this.

MerMer

--~--~-~--~~~---~--~~
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: Templatedb problem

2007-03-08 Thread Mary

OHH i just found the solution which is that i miss to add this line in
view.py
from blog.savedtemplate.models import Template

and it solved my issue :)
Thank you ;
Mary Adel


On Mar 8, 1:59 pm, "Mary" <[EMAIL PROTECTED]> wrote:
> I just have another one issue about the template db
> I have created a template in the database and i called it blog/
> home.html
>
> and i wrote may view like this :
>
> from django.shortcuts import render_to_response
> from blog.home.models import Blog
> def home(request):
>
> return render_to_response('blog/home.html')
>
> But i got an error which is
> Exception Type: TemplateDoesNotExist
> Exception Value:/blog/home.html
> Exception Location: /usr/lib/python2.4/site-packages/Django-0.95.1-
> py2.4.egg/django/template/loader.py in find_template_source, line 72
> Template-loader postmortem
>
> Django tried loading these templates, in this order:
>
> * Using loader
> django.template.loaders.filesystem.load_template_source:
>   o /blog/home.html (File does not exist)
> * Using loader
> django.template.loaders.app_directories.load_template_source:
>   o /blog/home.html (File does not exist)
>   o /blog/home.html (File does not exist)
> * Using loader
> blog.savedtemplate.loaders.database.load_template_source:
>
> Can anyone tell me please what is my mistake as i really can't know
> Thank you very much
> Mary Adel
>
> On Mar 8, 11:49 am, "Mary" <[EMAIL PROTECTED]> wrote:
>
> > Dear Malcom ;
> > I have renamed my version to "myapp.savedtemplate" and it worked fine
> > with me
> > so my problem has been solved and i really appreciate your help;
>
> > Thank you very much ;
> > Mary Adel
>
> > On Mar 7, 1:00 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Wed, 2007-03-07 at 01:41 -0800, Mary wrote:
> > > > Dear Malcom;
>
> > > > I have commented this line #from template.models import Template
> > > > in template/loaders/database.py
>
> > > > and it works fine with but i don't know if it will affect any of the
> > > > functionality or not
>
> > > That's not a good idea. It will break a lot of things having to do with
> > > templating.
>
> > > > also my setting.py is :
> > > > TEMPLATE_LOADERS = (
> > > > 'django.template.loaders.filesystem.load_template_source',
> > > > 'django.template.loaders.app_directories.load_template_source',
> > > > 'myapp.template.loaders.database.load_template_source',
>
> > > > )
>
> > > > MIDDLEWARE_CLASSES = (
> > > > 'django.middleware.common.CommonMiddleware',
> > > > 'django.contrib.sessions.middleware.SessionMiddleware',
> > > > 'django.contrib.auth.middleware.AuthenticationMiddleware',
> > > > 'django.middleware.doc.XViewMiddleware',
> > > > "myapp.middleware.threadlocals.ThreadLocals",
> > > > )
>
> > > > ROOT_URLCONF = 'myapp.urls'
>
> > > > TEMPLATE_DIRS = (
> > > > # Put strings here, like "/home/html/django_templates".
> > > > # Always use forward slashes, even on Windows.
> > > > "/var/www/myapp/Template_Dir/",
> > > > )
>
> > > > INSTALLED_APPS = (
> > > > 'django.contrib.auth',
> > > > 'django.contrib.contenttypes',
> > > > 'django.contrib.sessions',
> > > > 'django.contrib.sites',
> > > > 'django.contrib.admin',
> > > > 'django.contrib.markup',
> > > > '.myapp.articles',
>
> > > This line looks a little suspicious (the leading '.'), but it may be
> > > fine.
>
> > > > 'myapp.stockphoto',
> > > > 'myapp.template',
>
> > > This is probably where your problem lies. From your error message, it
> > > looks like there is some confusion between your package called
> > > "template" and Django's internal "template" package. Try renaming your
> > > version to "myapp.templateX" or something like that and see if the
> > > problem goes away.
>
> > > I realise this is a bit ugly if it is the solution, but some of the
> > > dynamic importing inside Django can cause problems sometimes. If
> > > renaming here does make your problem go away, let us know, because it
> > > might be something we can look at fixing in the future. (And, obviously,
> > > if that doesn't fix the problem, let us know too and somebody might have
> > > some other ideas.)
>
> > > Regards,
> > > Malcolm


--~--~-~--~~~---~--~~
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: New framework configuration

2007-03-08 Thread Nathan R. Yergler

On 3/7/07, jlnn <[EMAIL PROTECTED]> wrote:
>
> We were hoping to avoid that, because we have multiple development/
> test and production servers that need to be configured exactly the
> same. Standard configs is the best way to ensure that.
>

It's an academic debate or matter of personal taste, I suppose, but
I'd argue that building it yourself is the way to ensure the same
config rather than using the system python which gets lots of other
things (potentially) thrown into it.

Regardless, at Creative Commons we use tools like zc.buildout to make
dependency management trivial (or at least sane).  FWIW.

NRY

> On Mar 7, 10:37 am, "Nathan R. Yergler" <[EMAIL PROTECTED]> wrote:
> > I'm not sure I fully understand the question, but why not just build
> > Python from source in something like /usr/local/python244?
> >
> > Nathan
> >
> > On 3/7/07, jlnn <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > We're trying to set up a framework for our developers. We're using a
> > > standard install of RHEL ES4. If we modify the configuration to use
> > > Python 2.4 the admin tools break and RedHat won't support the
> > > installation. We've tried using Python 2.3, but a recent bug,
> > > according to our development manager, makes that problematic. We use
> > > the Apache/mod_python installation for the framework. Has anyone
> > > gotten this to work and how is it accomplished without modifying the
> > > OS?
> > > Thanks ahead of time.
>
>
> >
>

--~--~-~--~~~---~--~~
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: Marking a DateField event as "repeating"

2007-03-08 Thread Jay Parlar

On 3/8/07, Gary Doades <[EMAIL PROTECTED]> wrote:
>
> I'm working on this very problem.
>
> The best way I have found so far is to use the rrule stuff from the
> python-dateutil package.
>
> Given a repeat interval such as DAILY, WEEKLY, MONTHLY etc. it can
> generate all the dates that your event occurs on between two dates.
>
> It will even generate for just "weekdays" or every other Monday etc.
> etc. It also takes care of different sized months, leap years, etc.
>
> All you then need to do is store the parameters to the rrule in a table
> and most of the work is done.
>
> To retrieve from the database all you need to do is find all the ones
> that occur in your month of choice, feed all the rrules into an rruleset
> and generate everything in one line by list'ing the rruleset.
>

So in your Event model (or whatever you're calling it), you're
essentially storing the keyword arguments to an rrule, depending on
what's necessary for a particular event?

Then whenever you need to render a calendar, you pull in all the
Events from the db, create rrules for each using the stored
parameters, and just work with the dateutil library to do the rest?

Jay P.

--~--~-~--~~~---~--~~
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: dojo problem

2007-03-08 Thread Nathan R. Yergler

On 3/7/07, Mary <[EMAIL PROTECTED]> wrote:
>
> I have really tried with dojo and i worked with this steops exactly
> http://code.djangoproject.com/wiki/AddDojoEditor
> and i didn't see anything in my text Area field
>
> I have django 0.95.1 i have installed dojo 0.4
>
> Can anyone help please as i spent a lot of time to know what is the
> problem with nothing
> also i tried to added AddRichTextEditing.js' in django/contrib/admin/
> jss/admin
> also nothing changes

Did you add it to django/contrib/admin/js/admin, or
django/contrib/admin/media/js/admin? (note the *media* directory)

>
>
>
> On Mar 7, 3:06 pm, "Nathan R. Yergler" <[EMAIL PROTECTED]> wrote:
> > On 3/6/07, Mary <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > here is my model :
> > > text = models.TextField(help_text='Rich Text Editing.')
> > > class Admin:
> > > js = ['js/admin/AddRichTextEditing.js']
> >
> > > list_display = ('title','owner','time_created')
> >
> > > i have added the dojo folder in my media folder and i have added
> > > AddRichTextEditing.js in js/admin/AddRichTextEditing.js'
> >
> > > I have no idea why the test are doesn't appear with text editor
> > > I am using django 0.95.1 and when i click on my browser
> > > http//:mywebsite/media/js/admin/AddRichTextEditing.js
> > > i can see the script
> > > any ide why is this happening
> >
> > In Django 0.95 (may also apply to HEAD, not certain), the URLs
> > provided in the js attribute are interpreted as relative to the admin
> > application's media folder.  So you'd want to put your
> > AddRichTextEditing.js file in django/contrib/admin/media/js/admin/ to
> > make your setting above work.
> >
> >
> >
> > > Thank you ;
> > > Mary Adel
>
>
> >
>

--~--~-~--~~~---~--~~
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: Intializing newforms Form objects

2007-03-08 Thread Vertigo

I am struggling right now with the same concerns :-)
I have a hand-written form for a model with ManyToMany field.

So far, I noted a few things that helped me come to a working
solution, but maybe not really elegant...

The form initialization with an object looks like this (I hope...):
my_form = MyForm(initial=my_object.__dict__)
=> ManyToMany fields do not show up in that __dict__.

I had to add them by hand, turning the above one-liner into this:
initial_values = my_object.__dict__
initial_values.update({'m2m_field' = [obj.id for obj in
my_object.m2m_field.all()]})
my_form = MyForm(initial=initial_values)

To summarize, I built the list of ids from the ManyToMany relation to
my form, appending that list to the dict passed as initial data.

I am not really happy with that solution, maybe some more advanced
newforms user may lead a better way.


--~--~-~--~~~---~--~~
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: myghtyboard forum problem

2007-03-08 Thread [EMAIL PROTECTED]

I've never seen it, so I'm just speculating here, but I think it's
throwing a wobbly cause you don't have any topics in the forum yet.
Looking at the source, I see:
class Forum(models.Model):
   ...
   forum_topics = models.PositiveIntegerField(default='0', blank=True,
verbose_name=_("Topics")) # number of topics

I think if you add null=True there (and update the DB to match) you
should be OK.



On Mar 8, 5:08 am, "zehi" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I downloaded diamanda fro google.code and followed instructions 
> at:http://diamanda.googlecode.com/svn/trunk/README.TXT
>
> Everything works just fine, I have anly problem with 'Add Forum'.
>
> I am getting the following error message:
>
> IntegrityError at /admin/myghtyboard/forum/add/
> myghtyboard_forum.forum_topics may not be NULL
> Request Method: POST
> Request URL:http://127.0.0.1:8000/admin/myghtyboard/forum/add/
> Exception Type: IntegrityError
> Exception Value:myghtyboard_forum.forum_topics may not be NULL
> Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/
> lib/python2.5/site-packages/django/db/backends/sqlite3/base.py in
> execute, line 92
>
> The question is: what couse the problem?
>
> Thank you.


--~--~-~--~~~---~--~~
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: Any HTML to Latex module available in Python that can be integrated into Django

2007-03-08 Thread Kjell Magne Fauske



On Mar 7, 8:17 pm, "Ramdas S" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a web site, which needs to output HTML content as Latex
>
> Ramdas S

I don't know of any Python library that converts from HTML to LaTeX.
However, writing one should not be that difficult. It is at least much
easier than writing a LaTeX2Html translator. You could parse the HTML
code using for instance elementree[1] and Beautifulsoup[2]. You can
then iterate over the parsed html tree and output corresponding LaTeX
markup:
name -> \section{name}
name -> \subsection {name}
 -> \begin{itemize}
text -> \item text


[1] http://effbot.org/zone/element-index.htm
[2] http://www.crummy.com/software/BeautifulSoup/

reStructuredText(http://docutils.sourceforge.net/rst.html ) can
generate both LaTeX and HTML from simple text files. It is used to
document Django.


- Kjell Magne Fauske


--~--~-~--~~~---~--~~
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: Intializing newforms Form objects

2007-03-08 Thread Rubic

Anders,

I think the simple answer is for foreign keys (including
ChoiceFields when they're foreign keys), you want
to pass it the id/pk of the object.  If the ChoiceFields
are a list of tuples, just pass it the value.

For multiple selection values, pass it a list of the values
you want selected.  I have an example here where I
store the value as a comma-delimited string, and use
a custom widget to convert it to a list:
http://www.djangosnippets.org/snippets/23/

--
Jeff Bauer
Rubicon, Inc.


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



How to implement multi-level cascaded DISTINCT JOIN using django's object model?

2007-03-08 Thread Alex Dong

Hi all,

I have a data model like this:
* a `user` has multiple `questions`
* a `user` could give multiple `answer`s or `comment`s to any
`question`s.
So here, there are
* a one-to-many relationship from `user` to `question`
* a many-to-many relationship between `question` and `answer`,
`question` and `comment`.
Now I need to pull out a list of all the questions a given user has
either answered or commented on.  I could do `user.question_set` or
`user.answer_set`.

Now if I write a template like this:
` {% for answer in user.answer_set %}
 ... {{ answer.question. ... }}
  {% endfor %}
`
I could end up with showing the same questions many times.

I know for sure that this task is not that difficult if I retreat to
using `JOIN` and use raw sql for my query. But I'm wondering does
Django  offers a neat solution for this question without using raw
sql?

Thanks,
Alex


--~--~-~--~~~---~--~~
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: Intializing newforms Form objects

2007-03-08 Thread anders conbere

On 3/8/07, Vertigo <[EMAIL PROTECTED]> wrote:
>
> I am struggling right now with the same concerns :-)
> I have a hand-written form for a model with ManyToMany field.
>
> So far, I noted a few things that helped me come to a working
> solution, but maybe not really elegant...
>
> The form initialization with an object looks like this (I hope...):
> my_form = MyForm(initial=my_object.__dict__)
> => ManyToMany fields do not show up in that __dict__.
>
> I had to add them by hand, turning the above one-liner into this:
> initial_values = my_object.__dict__
> initial_values.update({'m2m_field' = [obj.id for obj in
> my_object.m2m_field.all()]})
> my_form = MyForm(initial=initial_values)
>
> To summarize, I built the list of ids from the ManyToMany relation to
> my form, appending that list to the dict passed as initial data.
>
> I am not really happy with that solution, maybe some more advanced
> newforms user may lead a better way.

I'm hoping to make a generic function that would do both __dict__ and
handle m2m fields (o2m fields as well) that would let you one off
these kinds of things.  The problem with this stuff being that if you
have an object with any signifigant number of m2m fields there's just
a lot of cruft in your view.

>
>
> >
>

--~--~-~--~~~---~--~~
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: Intializing newforms Form objects

2007-03-08 Thread anders conbere

On 3/8/07, Rubic <[EMAIL PROTECTED]> wrote:
>
> Anders,
>
> I think the simple answer is for foreign keys (including
> ChoiceFields when they're foreign keys), you want
> to pass it the id/pk of the object.  If the ChoiceFields
> are a list of tuples, just pass it the value.
>
> For multiple selection values, pass it a list of the values
> you want selected.  I have an example here where I
> store the value as a comma-delimited string, and use
> a custom widget to convert it to a list:
> http://www.djangosnippets.org/snippets/23/
>

That's pretty slick if I do say so myself.  Thanks, I think what I
really need to do is sit down and make a test model that has, m2m,
o2m, and FK relations, and then build a form and a bunch of tests and
just hammer out exactly what's going on in there.

> --
> Jeff Bauer
> Rubicon, Inc.
>
>
> >
>

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



new forms admin

2007-03-08 Thread enquest

What effect wil the new form lib have on the admin. I read that its
being remade. But will the admin app bread an will you need to change
your code for the new one?



Enquest


--~--~-~--~~~---~--~~
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: new forms admin

2007-03-08 Thread Adrian Holovaty

On 3/8/07, enquest <[EMAIL PROTECTED]> wrote:
> What effect wil the new form lib have on the admin. I read that its
> being remade. But will the admin app bread an will you need to change
> your code for the new one?

Here's the writeup:

http://code.djangoproject.com/wiki/NewformsAdminBranch

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.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: Template Tags

2007-03-08 Thread limodou

On 3/8/07, Merric Mercer <[EMAIL PROTECTED]> wrote:
>
> I have a template that loops through a simple query set and displays the
> data in a table.
>
> I now need to add another column to my table.  However,  the data in the
> new column is a calculation based on two of the other fields
> in that record.
>
> I presume that this can be done using a template tag, but I can't work
> out how it can be done.  I can't see how I can pass the values of the
> other fields into
> a tag.  Can anybody please advise the best way to do this.
>
> MerMer
>
You can see :

http://www.djangosnippets.org/snippets/9/


-- 
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou

--~--~-~--~~~---~--~~
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: Marking a DateField event as "repeating"

2007-03-08 Thread Gary Doades

>
> So in your Event model (or whatever you're calling it), you're
> essentially storing the keyword arguments to an rrule, depending on
> what's necessary for a particular event?
>
> Then whenever you need to render a calendar, you pull in all the
> Events from the db, create rrules for each using the stored
> parameters, and just work with the dateutil library to do the rest?
>
> Jay P.

More or less, yes.

I have a Django model (from my original test code):

class ResourceSchedule(models.Model):
description = models.CharField(maxlength=64)
daymap = models.IntegerField()
monthmap = models.SmallIntegerField(default=4095)
period =
models.SmallIntegerField(default=0,choices=RESOURCE_SCHEDULE_PERIODS,validator_list=[validators.NumberIsInRange(0,6)])
frequency = models.SmallIntegerField(default=1)
time_from = models.TimeField(default='09:00:00')
duration = models.TimeField(default='00:30:00')
date_from = models.DateField()
date_to = models.DateField(null=True)


Which covers all the rule bits I will need.

The daymap and monthmap are used depending on what the period is (Weekly,
Monthly etc.) to store exactly wich days & months the event should repeat
in. I store these as a bitmap for minimizing data storage, but it is
easily searchable with SQL and the bitmaps can be simply expanded to lists
for display in forms (as Checkbox Lists for example). You could of course
store the days/months more explicitly in your table.

frequency is the interval part of the rule giving you every 'n' weeks for
example.

Its pretty easy to then find the ResourceSchedules that might be
candidates for having events in your datefrom/dateto period and shoving
them into and rrule/rruleset.

It might be overkill for some simple tasks but I need the flexibility.
This way I can store/generate just about any repeating pattern I care to
think of.

Regards,
Gary.



--~--~-~--~~~---~--~~
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: Marking a DateField event as "repeating"

2007-03-08 Thread Jay Parlar

On 3/8/07, Gary Doades <[EMAIL PROTECTED]> wrote:
>
> >
> > So in your Event model (or whatever you're calling it), you're
> > essentially storing the keyword arguments to an rrule, depending on
> > what's necessary for a particular event?
> >
> > Then whenever you need to render a calendar, you pull in all the
> > Events from the db, create rrules for each using the stored
> > parameters, and just work with the dateutil library to do the rest?
> >
> > Jay P.
>
> More or less, yes.
>
> I have a Django model (from my original test code):
>
> class ResourceSchedule(models.Model):
> description = models.CharField(maxlength=64)
> daymap = models.IntegerField()
> monthmap = models.SmallIntegerField(default=4095)
> period =
> models.SmallIntegerField(default=0,choices=RESOURCE_SCHEDULE_PERIODS,validator_list=[validators.NumberIsInRange(0,6)])
> frequency = models.SmallIntegerField(default=1)
> time_from = models.TimeField(default='09:00:00')
> duration = models.TimeField(default='00:30:00')
> date_from = models.DateField()
> date_to = models.DateField(null=True)
>
>
> Which covers all the rule bits I will need.
>
> The daymap and monthmap are used depending on what the period is (Weekly,
> Monthly etc.) to store exactly wich days & months the event should repeat
> in. I store these as a bitmap for minimizing data storage, but it is
> easily searchable with SQL and the bitmaps can be simply expanded to lists
> for display in forms (as Checkbox Lists for example). You could of course
> store the days/months more explicitly in your table.
>
> frequency is the interval part of the rule giving you every 'n' weeks for
> example.
>
> Its pretty easy to then find the ResourceSchedules that might be
> candidates for having events in your datefrom/dateto period and shoving
> them into and rrule/rruleset.
>
> It might be overkill for some simple tasks but I need the flexibility.
> This way I can store/generate just about any repeating pattern I care to
> think of.

Mostly I'm cool with that, but one thing just isn't clicking yet: Your
date_from and date_to fields, I'm guessing these represent the from/to
dates of the *original* event, and aren't affected by repetitions? So
if that's the case, how do you initially pull your ResourceSchedules
out of the database? It looks to me like you'd have to pull them all
out (ie. ResourceSchedule.objects.all()), generate rrules for all of
them, and see which of the rrules fit into a desired timespan. Is that
right?

By the way, it warms my heart to see you storing bitfields. My area is
embedded devices, not web stuff, so I often spend my days working with
bitfields and masks and such. Good to see that tradition carried into
some Django :)

Jay P.

--~--~-~--~~~---~--~~
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: Marking a DateField event as "repeating"

2007-03-08 Thread [EMAIL PROTECTED]



On Mar 8, 4:31 pm, "Jay Parlar" <[EMAIL PROTECTED]> wrote:

> Mostly I'm cool with that, but one thing just isn't clicking yet: Your
> date_from and date_to fields, I'm guessing these represent the from/to
> dates of the *original* event, and aren't affected by repetitions? So
> if that's the case, how do you initially pull your ResourceSchedules
> out of the database? It looks to me like you'd have to pull them all
> out (ie. ResourceSchedule.objects.all()), generate rrules for all of
> them, and see which of the rrules fit into a desired timespan. Is that
> right?
>
> By the way, it warms my heart to see you storing bitfields. My area is
> embedded devices, not web stuff, so I often spend my days working with
> bitfields and masks and such. Good to see that tradition carried into
> some Django :)
>
> Jay P.- Hide quoted text -
>
> - Show quoted text -

Sorry, the date_from and date_to are probably superfluous for your
needs. For my system they represent the period that this schedule is
valid for and therefore the absolute extent that rrule can generate
dates for.

For my application I don't have to pull them all out. I'm writing a
booking/scheduleing system and mostly people will search for "things"
on a particular day(s) or for a particular month or between two
specific dates etc. Using the bitmaps and simple bitwise math I can
pull out just the ones that are *likely* to have dates in them.

You could always store another marker or two to give a good first line
SQL filtering depending on how you want to look for them. The idea is
to probably get a few more than you might need, but not *too many*
more! Finding all the records that fall on a monday or in the month of
May is pretty easy with the SQL, then just rrule them to find the
actual dates depending on the other repeat criteria.

Otherwise you would have to pull them all out yes. However, if you
have rules that repeat on every day or every other day you are not
likely to have very many of them for any one specific calendar.

Also I store these Schedules as a top level table. I then create
Resources (Events?) that "use" a specific schedule. This way I can
have lots of Resources that use the same Schedule, again minimising
the number of schedule records.

You can then create nice names for the schedules (in the description
field), call them "Weekly", "Monthly", "Every second Thursday" etc.
and have a pick list of common schedules to assign to events or
whatever.

Again, it's probably overkill for a simple calendar, but damn
powerful!! Just some ideas to mull over then :)

Regards,
Gary.




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



Re: How to implement multi-level cascaded DISTINCT JOIN using django's object model?

2007-03-08 Thread Atilla

On 08/03/07, Alex Dong <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I have a data model like this:
> * a `user` has multiple `questions`
> * a `user` could give multiple `answer`s or `comment`s to any
> `question`s.
> So here, there are
> * a one-to-many relationship from `user` to `question`
> * a many-to-many relationship between `question` and `answer`,
> `question` and `comment`.
> Now I need to pull out a list of all the questions a given user has
> either answered or commented on.  I could do `user.question_set` or
> `user.answer_set`.
>
> Now if I write a template like this:
> ` {% for answer in user.answer_set %}
>  ... {{ answer.question. ... }}
>   {% endfor %}
> `
> I could end up with showing the same questions many times.
>
> I know for sure that this task is not that difficult if I retreat to
> using `JOIN` and use raw sql for my query. But I'm wondering does
> Django  offers a neat solution for this question without using raw
> sql?
>
> Thanks,
> Alex
>

How about this: Question.objects.filter(answer__user_id=userID) - this
should give you the question objects for which the user has given
answers. Extend the filter with a Q clause to do the OR for comments.
You may need to throw a .distinct() in there as well. I've got a
similar thing that works, I'm just not sure about the exact syntax for
your case.

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



Permalink decorator and generic views

2007-03-08 Thread dchandek

I was happy to find the addition of the permalink decorator in the
development version as a help in removing hardcoded paths from
get_absolute_url() methods.

Unfortunately, using it requires that you define a custom view (even
if the custom view simply returns a generic view). Interestingly, you
can actually refer to a generic view in get_absolute_url():

def get_absolute_url(self):
return ('django.views.generic.list_detail.object_detail',
(str(self.id),))
get_absolute_url = permalink(get_absolute_url)

but it seems to return the first reference to that generic view in the
URLconf. Thus, what would seem to be a common development pattern is
disturbed: defining URLs that point to detail views "directly" using
generic views.

Just a comment ...


--~--~-~--~~~---~--~~
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: Marking a DateField event as "repeating"

2007-03-08 Thread Jay Parlar

On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Sorry, the date_from and date_to are probably superfluous for your
> needs. For my system they represent the period that this schedule is
> valid for and therefore the absolute extent that rrule can generate
> dates for.
>
> For my application I don't have to pull them all out. I'm writing a
> booking/scheduleing system and mostly people will search for "things"
> on a particular day(s) or for a particular month or between two
> specific dates etc. Using the bitmaps and simple bitwise math I can
> pull out just the ones that are *likely* to have dates in them.
>
> You could always store another marker or two to give a good first line
> SQL filtering depending on how you want to look for them. The idea is
> to probably get a few more than you might need, but not *too many*
> more! Finding all the records that fall on a monday or in the month of
> May is pretty easy with the SQL, then just rrule them to find the
> actual dates depending on the other repeat criteria.
>
> Otherwise you would have to pull them all out yes. However, if you
> have rules that repeat on every day or every other day you are not
> likely to have very many of them for any one specific calendar.
>
> Also I store these Schedules as a top level table. I then create
> Resources (Events?) that "use" a specific schedule. This way I can
> have lots of Resources that use the same Schedule, again minimising
> the number of schedule records.
>
> You can then create nice names for the schedules (in the description
> field), call them "Weekly", "Monthly", "Every second Thursday" etc.
> and have a pick list of common schedules to assign to events or
> whatever.
>
> Again, it's probably overkill for a simple calendar, but damn
> powerful!! Just some ideas to mull over then :)
>


Ahh, ok, that makes sense now. It might be overkill for what I'm
doing, but I can just see the requirements for this continually
increasing. Having the structure already in place to do whatever I
want would be a good thing :)

Thanks,
Jay P.

--~--~-~--~~~---~--~~
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: myghtyboard forum problem

2007-03-08 Thread zehi

HI baxter,

I did exactly as you proposed, but the result is unfortunately the
same.

I've even created fresh database, but when I go to Admin, create the
new category and then trying to add new Forum and getting the same
error page saying as above...

Some other idea, what could cause the problem?

Thank you.

On Mar 8, 3:44 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I've never seen it, so I'm just speculating here, but I think it's
> throwing a wobbly cause you don't have any topics in the forum yet.
> Looking at the source, I see:
> class Forum(models.Model):
>...
>forum_topics = models.PositiveIntegerField(default='0', blank=True,
> verbose_name=_("Topics")) # number of topics
>
> I think if you add null=True there (and update the DB to match) you
> should be OK.
>
> On Mar 8, 5:08 am, "zehi" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I downloaded diamanda fro google.code and followed instructions 
> > at:http://diamanda.googlecode.com/svn/trunk/README.TXT
>
> > Everything works just fine, I have anly problem with 'Add Forum'.
>
> > I am getting the following error message:
>
> > IntegrityError at /admin/myghtyboard/forum/add/
> > myghtyboard_forum.forum_topics may not be NULL
> > Request Method: POST
> > Request URL:http://127.0.0.1:8000/admin/myghtyboard/forum/add/
> > Exception Type: IntegrityError
> > Exception Value:myghtyboard_forum.forum_topics may not be NULL
> > Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/
> > lib/python2.5/site-packages/django/db/backends/sqlite3/base.py in
> > execute, line 92
>
> > The question is: what couse the problem?
>
> > Thank you.


--~--~-~--~~~---~--~~
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: Any HTML to Latex module available in Python that can be integrated into Django

2007-03-08 Thread Atilla

If you're familiar with XSLT then that should also be a good
candidate. The problem there is that things could get complicated, if
the HTML document is not a well-formed XML document.


On 08/03/07, Kjell Magne Fauske <[EMAIL PROTECTED]> wrote:
>
>
>
> On Mar 7, 8:17 pm, "Ramdas S" <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I have a web site, which needs to output HTML content as Latex
> >
> > Ramdas S
>
> I don't know of any Python library that converts from HTML to LaTeX.
> However, writing one should not be that difficult. It is at least much
> easier than writing a LaTeX2Html translator. You could parse the HTML
> code using for instance elementree[1] and Beautifulsoup[2]. You can
> then iterate over the parsed html tree and output corresponding LaTeX
> markup:
> name -> \section{name}
> name -> \subsection {name}
>  -> \begin{itemize}
> text -> \item text
> 
>
> [1] http://effbot.org/zone/element-index.htm
> [2] http://www.crummy.com/software/BeautifulSoup/
>
> reStructuredText(http://docutils.sourceforge.net/rst.html ) can
> generate both LaTeX and HTML from simple text files. It is used to
> document Django.
>
>
> - Kjell Magne Fauske
>
>
> >
>

--~--~-~--~~~---~--~~
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: newbie question: select_related from parent to child

2007-03-08 Thread Atilla

On 06/03/07, roberto <[EMAIL PROTECTED]> wrote:
>
> dear all,
>
> i'm starting to use django and i have what may seem to a lot of you
> the stupidest question ever, though i have not been able to solve
> this,.
>
> i have to classes:
>
> class warriors(models.Model):
> username = models.CharField(maxlength=50)
>
> class warriors_gaming(models.Model):
> warrior_id = models.OneToOneField(warriors)
> points = models.IntegerField()
>
> what i'd like is to perform a sql query like:
>
> select * from warriors, warriors_gaming where warriors.id =
> warriors_gaming = warrior_id and warriors.username = 'me'
>
> the object i would result therefore would have all properties of both
> tables. i am trying with:
>
> warriors_info = warriors.objects.get(username__exact = "robbie")
>
> which works ok however warriors_info.points does not exist as method
> or property. no luck with:
>
> warriors_info = warriors_gaming.objects.get(warriors__username__exact
> = "robbie")
>
> which gives me an error stating that 'warrior' is unknown. tried with:
>
> warriors_list = warriors_gaming.objects.select_related()
>
> which works, however i cannot find a place where to set my username =
> 'me' clause. i am sure this must be pretty simple but cannot find a
> way to do this... hopefully some nice soul will help me out to get
> started.
>
> thank you in advance,
>
> r.
>
>

Go carefully trough the DB API documentation. You can chain your query
methods to form quite complex expressions.  Look at .filter()

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



newb: Model.objects.select_related().get(id=4)

2007-03-08 Thread johnny

class City(models.Model):
# ...

class Person(models.Model):
# ...
hometown = models.ForeignKey(City)

class Book(models.Model):
# ...
author = models.ForeignKey(Person)
edited = models.ForeignKey(Person)

If do this: Book.objects.select_related().get(id=4), Would it get one
book object, the 2 person and 2 city object, like below?

book: -person-city (author who created it),
  -person-city (editor who edited it)

Thank you


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



Authenticating against Django's user database from Apache + FastCGI

2007-03-08 Thread canen

Hello,

I would like to restrict access to certain files based on user roles
and/or permission. I know about Authenticating against Django's user
database from Apache [1] but I am using FastCGI with Apache 1.3.3. I
read  this message[2] and specifically this comment [3] and I was
wondering if anyone has something like this working or could point me
in the right direction to getting this working.

Thanks.

[1] http://www.djangoproject.com/documentation/apache_auth/
[2] 
http://groups.google.com/group/django-developers/browse_thread/thread/357606bb8248e7ac/e7ad44b20fd363fb?#e7ad44b20fd363fb
[3] http://groups.google.com/group/django-developers/msg/e7ad44b20fd363fb


--~--~-~--~~~---~--~~
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: myghtyboard forum problem

2007-03-08 Thread [EMAIL PROTECTED]

Did you alter the db so it would allow that field to be null? Better
yet, now that I look at it.. forget making it null. Make sure it's
defaulting to 0, like it's supposed to.



On Mar 8, 11:08 am, "zehi" <[EMAIL PROTECTED]> wrote:
> HI baxter,
>
> I did exactly as you proposed, but the result is unfortunately the
> same.
>
> I've even created fresh database, but when I go to Admin, create the
> new category and then trying to add new Forum and getting the same
> error page saying as above...
>
> Some other idea, what could cause the problem?
>
> Thank you.
>
> On Mar 8, 3:44 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > I've never seen it, so I'm just speculating here, but I think it's
> > throwing a wobbly cause you don't have any topics in the forum yet.
> > Looking at the source, I see:
> > class Forum(models.Model):
> >...
> >forum_topics = models.PositiveIntegerField(default='0', blank=True,
> > verbose_name=_("Topics")) # number of topics
>
> > I think if you add null=True there (and update the DB to match) you
> > should be OK.
>
> > On Mar 8, 5:08 am, "zehi" <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I downloaded diamanda fro google.code and followed instructions 
> > > at:http://diamanda.googlecode.com/svn/trunk/README.TXT
>
> > > Everything works just fine, I have anly problem with 'Add Forum'.
>
> > > I am getting the following error message:
>
> > > IntegrityError at /admin/myghtyboard/forum/add/
> > > myghtyboard_forum.forum_topics may not be NULL
> > > Request Method: POST
> > > Request URL:http://127.0.0.1:8000/admin/myghtyboard/forum/add/
> > > Exception Type: IntegrityError
> > > Exception Value:myghtyboard_forum.forum_topics may not be NULL
> > > Exception Location: /Library/Frameworks/Python.framework/Versions/2.5/
> > > lib/python2.5/site-packages/django/db/backends/sqlite3/base.py in
> > > execute, line 92
>
> > > The question is: what couse the problem?
>
> > > Thank you.


--~--~-~--~~~---~--~~
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: Marking a DateField event as "repeating"

2007-03-08 Thread Jeremy Dunck

On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
...
> Also I store these Schedules as a top level table. I then create
> Resources (Events?) that "use" a specific schedule. This way I can
> have lots of Resources that use the same Schedule, again minimising
> the number of schedule records.

It seems we all have this problem.  :)

I was thinking about doing something similar to what Gary's doing, but
I'm more concerned with fast access than minimal records.  Also,
there's a "reasonable" window of time for which we'll ever have
records, say 10 years.

As such, I was thinking about having an Event model with recurrence
rules (perhaps admin'd with a little DSL), then blowing out a lot of
EventTime records for all the occurrences.  Editing would always be to
Events; EventTimes would be regenerated upon Event save.

The reduces queries to a simple date range, allowing very efficient index usage.

--~--~-~--~~~---~--~~
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: Marking a DateField event as "repeating"

2007-03-08 Thread Gary Doades

Yeah, I'd actually considered that. We do use that method on another 
product.

The big upside is that you don't have to store exceptions if you remove 
just one date in the future from the recurrence pattern, you just remove 
that one date record from the database.

There can be a big downside depending on what you are using it for. I'm 
using this sort of model for a "Resource Availability" kind of thing. 
Bookings/reservations etc. can be made against the available resource 
occurrences. If you want to change the schedule, you have to delete, 
re-insert or at least update all the actual records in the database, 
possibly all of these. If you have bookings against the original pattern 
then what to do with those existing bookings becomes a problem.

You also have to consider storage. Several 10 of millions of explicitly 
stored dates might become a problem :)

Basically the problem needs to be thought through from beginning to end. 
Not only how you are going to query the records, but also how you might 
update them together with any (possible) dependent records.

Bottom line options:

Store minimal data (rules) and dynamically regenerate actual dates on query.
  or
Store actual absolute dates (possibly with the original generation rule) 
and work out how to update them.

Storage and efficient query as opposed to raw cpu power perhaps?

It's not always easy.

Regards,
Gary.



Jeremy Dunck wrote:
> On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> ...
>> Also I store these Schedules as a top level table. I then create
>> Resources (Events?) that "use" a specific schedule. This way I can
>> have lots of Resources that use the same Schedule, again minimising
>> the number of schedule records.
> 
> It seems we all have this problem.  :)
> 
> I was thinking about doing something similar to what Gary's doing, but
> I'm more concerned with fast access than minimal records.  Also,
> there's a "reasonable" window of time for which we'll ever have
> records, say 10 years.
> 
> As such, I was thinking about having an Event model with recurrence
> rules (perhaps admin'd with a little DSL), then blowing out a lot of
> EventTime records for all the occurrences.  Editing would always be to
> Events; EventTimes would be regenerated upon Event save.
> 
> The reduces queries to a simple date range, allowing very efficient index 
> usage.
> 
> > 

--~--~-~--~~~---~--~~
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: Python HTML lib_filter

2007-03-08 Thread [EMAIL PROTECTED]

What I'd like to see (and maybe it's built-in somewhere and I've
overlooked it) is some sort of naughty-word filter.

On Mar 8, 12:35 am, "simonbun" <[EMAIL PROTECTED]> wrote:
> Good stuff! I am going to be needing this at some point and now i have
> a good base to start from.
>
> I have one enhancement that is very important to me (and should be to
> everyone). Seeing as this is the type of filter that would be used in
> blog comments for example, i would add a rel="nofollow" attribute to
> every off-site link. This effectively discourages comment spam.
> Perhaps you can make it optional, but i'd have it turned on by
> default.
> Here's some more reading on the 
> attribute:http://blog.searchenginewatch.com/blog/050118-204728
>
> Regards,
> Simon
>
> On Mar 8, 12:37 am, "Sam" <[EMAIL PROTECTED]> wrote:
>
> > You can see the power of "HTML Filter" by looking at the unit tests.
>
> >http://amisphere.com/contrib/python-html-filter/html-filter-test.html


--~--~-~--~~~---~--~~
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: Python HTML lib_filter

2007-03-08 Thread James Bennett

On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> What I'd like to see (and maybe it's built-in somewhere and I've
> overlooked it) is some sort of naughty-word filter.

Have a look at django.core.validators.hasNoProfanities, which looks
for a list of disallowed words in settings.PROFANITIES_LIST. If the
setting COMMENTS_ALLOW_PROFANITIES is False, django.contrib.comments
will apply that validator automatically to incoming comments.

-- 
"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: Video uploading and converting - queue system?

2007-03-08 Thread ScottB

Hi Henrik.

On Mar 7, 10:47 pm, "Henrik Lied" <[EMAIL PROTECTED]> wrote:
> So I've been thinking about a queue-system. How I should do this I'm
> not sure about. I was thinking about adding an extra field to the
> model (encoded = models.BooleanField), and setup a python script which
> returns all the non-encoded entries. This script then executes the
> os.system()-command, and sets encoded to True.
> I guess I'd have to setup a simple crontab that would run this script
> every 10-20 minute.

I think you're on the right track with this.  I have used a similar
approach in a few situations.  I think it is much more robust to add a
record to a queue and have a separate process do the long running
tasks.  The interface can then check the queue and display the status
of the tasks.

It's more robust in that if you servers have a high load and it takes
5 minutes to encode the video, you don't have to worry about the http
request timing out.  Instead, the user can see their video is
"processing" and continue with other things.  If it fails to convert
the video for some reason, you can show it as "failed" and maybe give
a "try again" option.

If you expect conversion will normally be fast, you can show the user
a progress indicator and use an Ajax call to poll the server and
update the display when it's done.

Scott


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



Testing Django App Running on Dev Server with Selenium

2007-03-08 Thread Paul Childs

I have Selenium RC running and I was wondering if someone might be
able to nudge me in the right direction. I am trying to at least get
my local web site, running on the Django dev server, to display in the
browser without an error, nothing more. Any help would be appreciated.

The following are the steps that I took while following along with the
Selenium tutorial.
http://www.openqa.org/selenium-rc/tutorial.html

I launch Selenium in the interactive mode

I open my website
cmd=getNewBrowserSession&1=*iexplore&2=http://127.0.0.1:8000
---> Requesting 
http://localhost:/selenium-server/driver?cmd=getNewBrowserSession&1=*iexplore&2=
http://127.0.0.1:8000
queryString = cmd=getNewBrowserSession&1=*iexplore&2=http://
127.0.0.1:8000
Modifying registry settings...
Launching Internet Explorer...
Got result: OK,1173381355673

I try to open the home page
cmd=open&1=http://127.0.0.1:8000/idms/&sessionId=1173381355673
---> Requesting 
http://localhost:/selenium-server/driver?cmd=open&1=http://127.0.0.1:8000/idms/&;
sessionId=1173381355673
queryString = cmd=open&1=http://127.0.0.1:8000/idms/
&sessionId=1173381355673
Got result: OK

Then I get this Django Error message in the browser...

TypeError at http://127.0.0.1:8000/idms/
unpack non-sequence
Request Method: GET
Request URL: http://127.0.0.1:8000http://127.0.0.1:8000/idms/   <
THIS IS INTERESTING
Exception Type: TypeError
Exception Value: unpack non-sequence
Exception Location: C:\Python24\lib\site-packages\django\core\handlers
\base.py in get_response, line 68

Traceback (most recent call last):
File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in
get_response
  68. callback, callback_args, callback_kwargs =
resolver.resolve(request.path)

  TypeError at http://127.0.0.1:8000/idms/
  unpack non-sequence

I tried the following and still got the same error as above..
cmd=open&1=/idms/&sessionId=1173381355673
---> Requesting 
http://localhost:/selenium-server/driver?cmd=open&1=/idms/&sessionId=11733813556
73
queryString = cmd=open&1=/idms/&sessionId=1173381355673
Got result: OK


--~--~-~--~~~---~--~~
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: Video uploading and converting - queue system?

2007-03-08 Thread ScottB

Hi Henrik.

On Mar 7, 10:47 pm, "Henrik Lied" <[EMAIL PROTECTED]> wrote:
> So I've been thinking about a queue-system. How I should do this I'm
> not sure about. I was thinking about adding an extra field to the
> model (encoded = models.BooleanField), and setup a python script which
> returns all the non-encoded entries. This script then executes the
> os.system()-command, and sets encoded to True.
> I guess I'd have to setup a simple crontab that would run this script
> every 10-20 minute.

I think you're on the right track with this.  I have used a similar
approach in a few situations.  I think it is much more robust to add a
record to a queue and have a separate process do the long running
tasks.  The interface can then check the queue and display the status
of the tasks.

It's more robust in that if you servers have a high load and it takes
5 minutes to encode the video, you don't have to worry about the http
request timing out.  Instead, the user can see their video is
"processing" and continue with other things.  If it fails to convert
the video for some reason, you can show it as "failed" and maybe give
a "try again" option.

If you expect conversion will normally be fast, you can show the user
a progress indicator and use an Ajax call to poll the server and
update the display when it's done.

Scott


--~--~-~--~~~---~--~~
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: Python HTML lib_filter

2007-03-08 Thread [EMAIL PROTECTED]

Is that only for comments, though? Guess I could genericize it.
Managed to do so for karma, so I guess I could for profanities, too.


On Mar 8, 1:39 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > What I'd like to see (and maybe it's built-in somewhere and I've
> > overlooked it) is some sort of naughty-word filter.
>
> Have a look at django.core.validators.hasNoProfanities, which looks
> for a list of disallowed words in settings.PROFANITIES_LIST. If the
> setting COMMENTS_ALLOW_PROFANITIES is False, django.contrib.comments
> will apply that validator automatically to incoming comments.
>
> --
> "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
-~--~~~~--~~--~--~---



Newbie with a question about Models, Managers and NCAA brackets.

2007-03-08 Thread [EMAIL PROTECTED]

Long time lurker, first time poster . . . (I would have asked more
questions before, but the answers have always been in the archives.)

I'm working on an app to show the rapidly approaching NCAA tournament
brackets, and am having some trouble with it. Since I'm quite new to
Django I thought I'd find out if my approach is the right way to go
before I invest any mroe time in it.

My model has two objects: Teams and Games:

Teams is pretty straight forward, with fields for name, region and
seed, among other elements that are pretty flat.

The games model is somewhat more complicated with fields for a gameID,
round, region, a winner, the seed x2 (if it's in the first round),
Previous Game x2 (if it's after the first round), and two teams. I'm
trying to use a manager to pull the teams in from the winners of the
previous games(or from the seeds/regions if it's the first round).
Does this sound like a good way to do it?


I'm including the model code (please don't laugh). The commented out
parts are where I've been having some trouble with the managers.

Any tips and suggestions would be greatly appreciated.

oh, and I'm running 0.95.1


from django.db import models

# Create your models here.

REGION_CHOICES = (
('1', 'Region in Upper Left'),
('2', 'Region in Lower Left'),
('3', 'Region in Upper Right'),
('4', 'Region in Lower Right'),
('5', 'Final Four'),
)

ROUND_CHOICES = (
('1', 'First Round'),
('2', 'Second Round'),
('3', 'Regionals'),
('4', 'Elite Eight'),
('5', 'Final Four'),
('6', 'Championship'),
  )

#class Game1Manager(models.Manager):
#if Games.round == 1:
  ### get the teams from the seed
  ### Select team from seed and region
#  def get_query_set(self):
#return
teams.objects.filter(region==self.objects.region).filter(seed==self.objects.seed_1)
#else:
#  ### get the teams from the previous winners
##if no winner, return nothing
#  ### Select team from the region and previous winner
#  def get_query_set(self):
#return self.objects.filter(gameID==previous_1).winner

class Team(models.Model):
  name = models.CharField(maxlength=20)
  region = models.IntegerField(choices=REGION_CHOICES)
  seed = models.IntegerField(null = True)

  class Admin:
pass
list_filter= ('region', )
list_display = ('name', 'region', 'seed')

  class Meta:
ordering = ['seed']

  def __str__(self):
return self.name

class Game(models.Model):
  gameID = models.IntegerField(unique=True)
  round = models.SmallIntegerField(choices=ROUND_CHOICES)
  region = models.IntegerField(choices=REGION_CHOICES)
  seed_1 = models.IntegerField(null=True)
  seed_2 = models.IntegerField(null=True)
#  team_1 = Game1Manager()
#  team_2 = Game2Manager()
  WINNER_CHOICES = ( ('1','team1'), ('2','team2'), )
  winner = models.IntegerField(blank=True, choices=WINNER_CHOICES)
  previous_1 = models.IntegerField(null=True)
  previous_2 = models.IntegerField(null=True)

  class Admin:
fields = (
('Game', {'fields': ('round','region','gameID',)}),
('Winner', {'fields': ('winner',)}),
('First round only', {'fields': ('seed_1','seed_2',)}),
('Relationship', {'fields':('previous_1','previous_2',)}),
)
list_filter  = ('round', 'region',)
list_display = ('round', 'winner', 'region', 'gameID', 'seed_1',
'seed_2',)

  class Meta:
unique_together = (("round", "gameID"),)

  def __str__(self):
return '%s %s vs %s' % (self.team1, self.team2, self.round)


--~--~-~--~~~---~--~~
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: Python HTML lib_filter

2007-03-08 Thread James Bennett

On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Is that only for comments, though? Guess I could genericize it.
> Managed to do so for karma, so I guess I could for profanities, too.

No, the validator itself is in django.core.validators.

The comments system will optionally apply that validator, but the
validator is not tied to the comment system.

-- 
"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 on mediatemple (dv) box?

2007-03-08 Thread leland

OK! figured this out. Turns out you have to install an older version
of mod_python - 3.1.4 to be precise. everything works perfectly now!

thanks for all of your help!

On Mar 7, 9:38 pm, Brian Rosner <[EMAIL PROTECTED]> wrote:
> On 2007-03-07 09:49:48 -0700, "leland" <[EMAIL PROTECTED]> said:
>
>
>
>
>
> > brian - thanks for that info! i recompiled mod_python (made a backup
> > first), but when i try to restart apache i get this error:
>
> > Cannot load /etc/httpd/modules/mod_python.so into server: /etc/httpd/
> > modules/mod_python.so: undefined symbol: apr_table_compress
>
> > i've seen on some other forums that my apr version needs to be 0.9.4,
> > and that is the version i'm running. any idea what that might be?
>
> > thanks again!
>
> > On Mar 7, 10:34 am, Brian Rosner <[EMAIL PROTECTED]> wrote:
> >> On 2007-03-06 20:51:14 -0700, "leland" <[EMAIL PROTECTED]> said:
>
> >>> joe - thanks for the tip. turns out it wasn't including the
> >>> vhosts.conf file. so i got everything to work onmediatemple's(dv)
> >>> 3.0 server. now, i've run into another issue. my company runs a (dv)
> >>> 2.0 box that came standard with python 2.2. i upgraded to python 2.3,
> >>> but now mod_python still points to the old python 2.2 install. does
> >>> anyone know how to change which python mod_python points to? or do i
> >>> have to re-compile? i thought maybe there would be a config file or
> >>> something like that for mod_python that would allow me to change this
> >>> easily. any help would be greatly appreciated!
>
> >>> thanks
>
> >> You will have to build mod_python with python 2.3.  it is pretty
> >> simple.  just download mod_python and point it to the apache you are
> >> running (which should automatically be detected) and python 2.3 (you
> >> may have to point it to the python executable if it isn't in the path).
> >> then make sure you make a backup of the current mod_python.so just in
> >> case something goes wrong.  then do a make install and it will put
> >> itself where it should go.  I believe this is in /etc/httpd/modules
> >> which symlinks to /usr/lib/httpd/modules.  Restart apache and you
> >> should be ready to go.
> >> --
> >> Brian Rosnerhttp://www.brosner.com/blog
>
> You mentioned you are working on a (dv) 2.0 server.  i assume those are
> the ones before the new (dv) servers they just recently released?  a
> few things i would check for is to make sure you are linking against
> apr 0.9.4.  i am not sure what version of apache you are linking with,
> but i was able to get it to work without a problem using apache 2.0.52.
> when you run ./configure in mod_python verify that it outputs 0.9.4 for
> the apr version.
>
> Brian


--~--~-~--~~~---~--~~
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: Python HTML lib_filter

2007-03-08 Thread [EMAIL PROTECTED]

I'll take a look. Thanks!

On Mar 8, 2:34 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > Is that only for comments, though? Guess I could genericize it.
> > Managed to do so for karma, so I guess I could for profanities, too.
>
> No, the validator itself is in django.core.validators.
>
> The comments system will optionally apply that validator, but the
> validator is not tied to the comment system.
>
> --
> "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
-~--~~~~--~~--~--~---



select_related() does not select many-to-many relations?

2007-03-08 Thread akonsu

hello,

as the subject says, select_related() does not return many-to-many
relations. is this a feature or a bug?

thanks
konstantin


--~--~-~--~~~---~--~~
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: myghtyboard forum problem

2007-03-08 Thread zehi

What do you exactly mean by saying: "Did you alter the db so it would
allow that field to be null?"

I returned to previous version without "null=True", syncdb, but still
same... :-(

I have downloaded code today. Is it possible, that thre would be some
little bug currently? Does somebody tried recently?

Thanks for any idea.

On Mar 8, 6:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Did you alter the db so it would allow that field to be null? Better
> yet, now that I look at it.. forget making it null. Make sure it's
> defaulting to 0, like it's supposed to.
>
> On Mar 8, 11:08 am, "zehi" <[EMAIL PROTECTED]> wrote:
>
> > HI baxter,
>
> > I did exactly as you proposed, but the result is unfortunately the
> > same.
>
> > I've even created fresh database, but when I go to Admin, create the
> > new category and then trying to add new Forum and getting the same
> > error page saying as above...
>
> > Some other idea, what could cause the problem?
>
> > Thank you.
>
> > On Mar 8, 3:44 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > I've never seen it, so I'm just speculating here, but I think it's
> > > throwing a wobbly cause you don't have any topics in the forum yet.
> > > Looking at the source, I see:
> > > class Forum(models.Model):
> > >...
> > >forum_topics = models.PositiveIntegerField(default='0', blank=True,
> > > verbose_name=_("Topics")) # number of topics
>
> > > I think if you add null=True there (and update the DB to match) you
> > > should be OK.
>
> > > On Mar 8, 5:08 am, "zehi" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > I downloaded diamanda fro google.code and followed instructions 
> > > > at:http://diamanda.googlecode.com/svn/trunk/README.TXT
>
> > > > Everything works just fine, I have anly problem with 'Add Forum'.
>
> > > > I am getting the following error message:
>
> > > > IntegrityError at /admin/myghtyboard/forum/add/
> > > > myghtyboard_forum.forum_topics may not be NULL
> > > > Request Method: POST
> > > > Request URL:http://127.0.0.1:8000/admin/myghtyboard/forum/add/
> > > > Exception Type: IntegrityError
> > > > Exception Value:myghtyboard_forum.forum_topics may not be NULL
> > > > Exception Location: 
> > > > /Library/Frameworks/Python.framework/Versions/2.5/
> > > > lib/python2.5/site-packages/django/db/backends/sqlite3/base.py in
> > > > execute, line 92
>
> > > > The question is: what couse the problem?
>
> > > > Thank you.


--~--~-~--~~~---~--~~
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: myghtyboard forum problem

2007-03-08 Thread [EMAIL PROTECTED]

Go to your database in phpmyadmin or something and see what that field
is doing. I don't think it's set up to insert the default value of 0

I grabbed the code for Myghtyboard right when it was first released
and have modded almost all of it by now, but that line is exactly the
same in mine. I think the problem is in your DB. Why, I'm not sure.


On Mar 8, 3:39 pm, "zehi" <[EMAIL PROTECTED]> wrote:
> What do you exactly mean by saying: "Did you alter the db so it would
> allow that field to be null?"
>
> I returned to previous version without "null=True", syncdb, but still
> same... :-(
>
> I have downloaded code today. Is it possible, that thre would be some
> little bug currently? Does somebody tried recently?
>
> Thanks for any idea.
>
> On Mar 8, 6:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Did you alter the db so it would allow that field to be null? Better
> > yet, now that I look at it.. forget making it null. Make sure it's
> > defaulting to 0, like it's supposed to.
>
> > On Mar 8, 11:08 am, "zehi" <[EMAIL PROTECTED]> wrote:
>
> > > HI baxter,
>
> > > I did exactly as you proposed, but the result is unfortunately the
> > > same.
>
> > > I've even created fresh database, but when I go to Admin, create the
> > > new category and then trying to add new Forum and getting the same
> > > error page saying as above...
>
> > > Some other idea, what could cause the problem?
>
> > > Thank you.
>
> > > On Mar 8, 3:44 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > I've never seen it, so I'm just speculating here, but I think it's
> > > > throwing a wobbly cause you don't have any topics in the forum yet.
> > > > Looking at the source, I see:
> > > > class Forum(models.Model):
> > > >...
> > > >forum_topics = models.PositiveIntegerField(default='0', blank=True,
> > > > verbose_name=_("Topics")) # number of topics
>
> > > > I think if you add null=True there (and update the DB to match) you
> > > > should be OK.
>
> > > > On Mar 8, 5:08 am, "zehi" <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi,
>
> > > > > I downloaded diamanda fro google.code and followed instructions 
> > > > > at:http://diamanda.googlecode.com/svn/trunk/README.TXT
>
> > > > > Everything works just fine, I have anly problem with 'Add Forum'.
>
> > > > > I am getting the following error message:
>
> > > > > IntegrityError at /admin/myghtyboard/forum/add/
> > > > > myghtyboard_forum.forum_topics may not be NULL
> > > > > Request Method: POST
> > > > > Request URL:http://127.0.0.1:8000/admin/myghtyboard/forum/add/
> > > > > Exception Type: IntegrityError
> > > > > Exception Value:myghtyboard_forum.forum_topics may not be NULL
> > > > > Exception Location: 
> > > > > /Library/Frameworks/Python.framework/Versions/2.5/
> > > > > lib/python2.5/site-packages/django/db/backends/sqlite3/base.py in
> > > > > execute, line 92
>
> > > > > The question is: what couse the problem?
>
> > > > > Thank you.


--~--~-~--~~~---~--~~
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: myghtyboard forum problem

2007-03-08 Thread zehi

All Right. It seems to be a problem somewhere else:

Both, localy and on server I run python 2.5. It looks like, that
diamanda installation procedure is calling older python version
2.4 ??? Is it possible?

sample:

[EMAIL PROTECTED] raw]$ python manage.py syncdb
[EMAIL PROTECTED] raw]$ cd ..
[EMAIL PROTECTED] django_current_python_25]$ export
DJANGO_SETTINGS_MODULE=raw.settings
[EMAIL PROTECTED] django_current_python_25]$ export PYTHONPATH=$PWD
[EMAIL PROTECTED] django_current_python_25]$ django-admin.py syncdb
Traceback (most recent call last):
  File "/home2/zehi/bin/django-admin.py", line 5, in ?
management.execute_from_command_line()
  File "/home2/zehi/lib/python2.4/django/core/management.py", line
1238, in execute_from_command_line
translation.activate('en-us')
  File "/home2/zehi/lib/python2.4/django/utils/translation/
trans_real.py", line 195, in activate
_active[currentThread()] = translation(language)
  File "/home2/zehi/lib/python2.4/django/utils/translation/
trans_real.py", line 184, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/home2/zehi/lib/python2.4/django/utils/translation/
trans_real.py", line 169, in _fetch
app = __import__(appname, {}, {}, [])
ImportError: No module named wiki

It's over my head yet. Somebody has experience with that?


On Mar 8, 11:34 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Go to your database in phpmyadmin or something and see what that field
> is doing. I don't think it's set up to insert the default value of 0
>
> I grabbed the code for Myghtyboard right when it was first released
> and have modded almost all of it by now, but that line is exactly the
> same in mine. I think the problem is in your DB. Why, I'm not sure.
>
> On Mar 8, 3:39 pm, "zehi" <[EMAIL PROTECTED]> wrote:
>
> > What do you exactly mean by saying: "Did you alter the db so it would
> > allow that field to be null?"
>
> > I returned to previous version without "null=True", syncdb, but still
> > same... :-(
>
> > I have downloaded code today. Is it possible, that thre would be some
> > little bug currently? Does somebody tried recently?
>
> > Thanks for any idea.
>
> > On Mar 8, 6:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Did you alter the db so it would allow that field to be null? Better
> > > yet, now that I look at it.. forget making it null. Make sure it's
> > > defaulting to 0, like it's supposed to.
>
> > > On Mar 8, 11:08 am, "zehi" <[EMAIL PROTECTED]> wrote:
>
> > > > HI baxter,
>
> > > > I did exactly as you proposed, but the result is unfortunately the
> > > > same.
>
> > > > I've even created fresh database, but when I go to Admin, create the
> > > > new category and then trying to add new Forum and getting the same
> > > > error page saying as above...
>
> > > > Some other idea, what could cause the problem?
>
> > > > Thank you.
>
> > > > On Mar 8, 3:44 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > I've never seen it, so I'm just speculating here, but I think it's
> > > > > throwing a wobbly cause you don't have any topics in the forum yet.
> > > > > Looking at the source, I see:
> > > > > class Forum(models.Model):
> > > > >...
> > > > >forum_topics = models.PositiveIntegerField(default='0', blank=True,
> > > > > verbose_name=_("Topics")) # number of topics
>
> > > > > I think if you add null=True there (and update the DB to match) you
> > > > > should be OK.
>
> > > > > On Mar 8, 5:08 am, "zehi" <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hi,
>
> > > > > > I downloaded diamanda fro google.code and followed instructions 
> > > > > > at:http://diamanda.googlecode.com/svn/trunk/README.TXT
>
> > > > > > Everything works just fine, I have anly problem with 'Add Forum'.
>
> > > > > > I am getting the following error message:
>
> > > > > > IntegrityError at /admin/myghtyboard/forum/add/
> > > > > > myghtyboard_forum.forum_topics may not be NULL
> > > > > > Request Method: POST
> > > > > > Request URL:http://127.0.0.1:8000/admin/myghtyboard/forum/add/
> > > > > > Exception Type: IntegrityError
> > > > > > Exception Value:myghtyboard_forum.forum_topics may not be 
> > > > > > NULL
> > > > > > Exception Location: 
> > > > > > /Library/Frameworks/Python.framework/Versions/2.5/
> > > > > > lib/python2.5/site-packages/django/db/backends/sqlite3/base.py in
> > > > > > execute, line 92
>
> > > > > > The question is: what couse the problem?
>
> > > > > > Thank you.


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



Re: How to implement multi-level cascaded DISTINCT JOIN using django's object model?

2007-03-08 Thread Alex Dong

Thanks a lot, Atilla.
`Question.objects.filter(answer__user=user).distinct()` returns
exactly what  I expect. This is wonderful, thanks a lot.  I also
recheck the django manual and found this solution has a name as "query
over related objects" (http://www.djangoproject.com/documentation/
db_api/#queries-over-related-objects). This is really powerful yet
simple enough.

Alex

On Mar 9, 12:56 am, Atilla <[EMAIL PROTECTED]> wrote:
> On 08/03/07, Alex Dong <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi all,
>
> > I have a data model like this:
> > * a `user` has multiple `questions`
> > * a `user` could give multiple `answer`s or `comment`s to any
> > `question`s.
> > So here, there are
> > * a one-to-many relationship from `user` to `question`
> > * a many-to-many relationship between `question` and `answer`,
> > `question` and `comment`.
> > Now I need to pull out a list of all the questions a given user has
> > either answered or commented on.  I could do `user.question_set` or
> > `user.answer_set`.
>
> > Now if I write a template like this:
> > ` {% for answer in user.answer_set %}
> >  ... {{ answer.question. ... }}
> >   {% endfor %}
> > `
> > I could end up with showing the same questions many times.
>
> > I know for sure that this task is not that difficult if I retreat to
> > using `JOIN` and use raw sql for my query. But I'm wondering does
> > Django  offers a neat solution for this question without using raw
> > sql?
>
> > Thanks,
> > Alex
>
> How about this: Question.objects.filter(answer__user_id=userID) - this
> should give you the question objects for which the user has given
> answers. Extend the filter with a Q clause to do the OR for comments.
> You may need to throw a .distinct() in there as well. I've got a
> similar thing that works, I'm just not sure about the exact syntax for
> your case.


--~--~-~--~~~---~--~~
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: trying to translate a join query to django

2007-03-08 Thread hotani

After digging through the messages here, I finally just did a custom
query. Here is the function I used that will spit out a template-ready
dictionary:

---
def csql(self,query,qkeys):
from django.db import connection
cursor = connection.cursor()
cursor.execute(query)
rows = cursor.fetchall()

# build dict for template:
fdicts = []
for row in rows:
i = 0
cur_row = {}
for key in qkeys:
cur_row[key] = row[i]
i = i+1
fdicts.append(cur_row)
return fdicts
-

it is called like so:
-
qkeys = ['id','name']
query = "SELECT id, name FROM stuff"
div_list = csql(request,query,qkeys)


In the template, it can be used like so:
---
{% for div in div_list %}
this is an id: {{ div.id }}, this is a name {{ div.name }}
{% 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
-~--~~~~--~~--~--~---



What's available in a view

2007-03-08 Thread fyl

This is somewhere between an observation and a question. I am writing
a view that needs to know "some stuff", in particular
HTTP_ACCEPT_LANGUAGE. As I read the developing book and look at the on-
line documentation, it is not clear what is available and, probably
more important, what is good practice to use it.

To that end, I am going to toss out a more generic comment.
Unfortunately, I don't have a good explanation to back it up. When I
read "Agile Web Development with Rails" I felt that while I am more
comfortable with Python and Rails seems a bit convoluted to me, that I
knew more along the way. That is, with that book, I found the author
anticipated my next question most of the time.

I don't know how to define this but the approach in that book (and
Programming Ruby) somehow makes things seem easier. I think that is
going to be an important piece of promoting Django so consider this an
observation from an outsider looking in rather than any serious
criticism.


--~--~-~--~~~---~--~~
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: Page Not Found 404

2007-03-08 Thread [EMAIL PROTECTED]

Hi,

Yes, I am using date based generic views for my blog. Then I am using
the admin to create posts. So, I think the cause is the JS control in
admin. Today my posts can be viewed correctly. But, I am developing in
my personal laptop using Windows XP, then I think the 'server' date
time shall be same with user date time. CMIIW Then, how to correct
this?

thanks and best regards,

On Mar 7, 6:14 am, Vadim Macagon <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Dear all,
>
> > I am making simple blog for myself using Django. After made models and
> > create necessary urls, I run the application and got: Page Not Found.
>
> > It says:
>
> > Page not found (404)
> > Request Method:GET
> > Request URL:  http://127.0.0.1:8000/blog/
>
> > No post available
>
> > Yes, it says No Post Available although there was one post.
>
> Assuming you're using the date based generic views for your blog you
> need to check that the post date is not in the future, because by
> default objects with a future date aren't displayed (you can change this
> by setting allow_future = True for the generic view).
>
> If you use the admin to create your posts you should also watch out for
> the JS controls that populate the date/time fields with the current
> date/time, they use the timezone of the user not the server (so
> depending on your timezone "today" for you may end up being "tomorrow"
> for the server).
>
> -+ enlight +-


--~--~-~--~~~---~--~~
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: Use images and css in templates

2007-03-08 Thread Tim Chase

> After I run : python manage.py runserver and browse my blog, it seems
> that it can't read my images and css. I am not using apache because I
> am developing my blog using my personal pc (Windows XP)
> 
> Here is my urls.py:
> 
> from django.conf.urls.defaults import *
> 
> urlpatterns = patterns('',
> # Example:
> # (r'^mysite/', include('mysite.apps.foo.urls.foo')),
> (r'^blog/', include('mysite.blog.urls')),
> (r'^site-media/(?P.*)$', 'django.views.static.serve',
> {'document_root':'d:\mysite\templates', 'show_indexes' : True}),

I don't know if this is the (only?) issue, but you're using
backslashes for your path, and "d:\mysite\templates" has a "\t"
in it.  You don't have it specified as a "raw" string, so that's
getting expanded to "d:\mysiteemplates" which isn't likely
what you mean.  You likely want either

'd:/mysite/templates'

or

r'd:\mysite\templates'

HTH,

-tkc





--~--~-~--~~~---~--~~
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 and jQuery Autocomplete Routing Help

2007-03-08 Thread johnny

I am new to python and javaScript, I have created a funtion that
return the tags via ajax.  I tried to replicate the php example.  But
it's not working.  I doesn't return any tags back to my html page via
ajax.  I need some help.  I am using jQuery autocomplete plugin from
here: 
http://just-tech.blogspot.com/2006/12/jquery-tweaking-auto-complete-plugin.html.
Here is my function in view:

def tag_autocomplete(request):
#$q = $_GET['q'];
#foreach($countries as $country) {
#if(eregi("^".$q, $country)) {
#echo $country."\r\n";
#}

s = request.GET.get('q', '')
current_tags = list(Tag.objects.all())
for tag in current_tags:
if (search (s.lower(), tag.normalized_tag)):
print "%s" % (tag.normalized_tag)



--~--~-~--~~~---~--~~
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: What's available in a view

2007-03-08 Thread James Bennett

On 3/8/07, fyl <[EMAIL PROTECTED]> wrote:
> This is somewhere between an observation and a question. I am writing
> a view that needs to know "some stuff", in particular
> HTTP_ACCEPT_LANGUAGE. As I read the developing book and look at the on-
> line documentation, it is not clear what is available and, probably
> more important, what is good practice to use it.

I agree that it's something we need to work on, especially with views;
unfortunately, a view can technically do absolutely anything that's
legal to do in Python, so long as it accepts a 'request' argument and
returns an HttpResponse, so it's a bit of a hurdle :)

With respect to the Accept-Language header, the request/response
docs[1] mention that it, and any other HTTP headers you want to look
at, are available in request.META -- in this case, it's
request.META['HTTP_ACCEPT_LANGUAGE'].

[1] http://www.djangoproject.com/documentation/request_response/

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



howto add join table field?

2007-03-08 Thread Greg Donald

How can I add a field in a join table?

I have this:

class Item(models.Model):
name = models.CharField(maxlength=32)

class List(models.Model):
name = models.CharField(maxlength=32)
items = models.ManyToManyField(Item)

which creates the 'list_items' join table fine, but then how do I put
a field in that same table?

When I try to add something like this:

class List_Items(models.Model):
quantity = models.IntegerField()

I get errors:

_mysql_exceptions.OperationalError: (1050, "Table 'stuff_list_items'
already exists")

Does Django have join models or the like?


Thanks,


-- 
Greg Donald
http://destiney.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: howto add join table field?

2007-03-08 Thread akonsu

hello,

i suspect you cannot do this (but i can be wrong because i myself do
not have much experience with django).

you could make your own association table manually in stead of using
ManyToManyField. of course in this case you won't have FOO_set methods
on your models.

konstantin

On Mar 8, 10:04 pm, "Greg Donald" <[EMAIL PROTECTED]> wrote:
> How can I add a field in a join table?
>
> I have this:
>
> class Item(models.Model):
> name = models.CharField(maxlength=32)
>
> class List(models.Model):
> name = models.CharField(maxlength=32)
> items = models.ManyToManyField(Item)
>
> which creates the 'list_items' join table fine, but then how do I put
> a field in that same table?
>
> When I try to add something like this:
>
> class List_Items(models.Model):
> quantity = models.IntegerField()
>
> I get errors:
>
> _mysql_exceptions.OperationalError: (1050, "Table 'stuff_list_items'
> already exists")
>
> Does Django have join models or the like?
>
> Thanks,
>
> --
> Greg Donaldhttp://destiney.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: Testing Django App Running on Dev Server with Selenium

2007-03-08 Thread Malcolm Tredinnick

On Thu, 2007-03-08 at 19:46 +, Paul Childs wrote:
[...]
> Then I get this Django Error message in the browser...
> 
> TypeError at http://127.0.0.1:8000/idms/
> unpack non-sequence
> Request Method: GET
> Request URL: http://127.0.0.1:8000http://127.0.0.1:8000/idms/   <
> THIS IS INTERESTING
> Exception Type: TypeError
> Exception Value: unpack non-sequence
> Exception Location: C:\Python24\lib\site-packages\django\core\handlers
> \base.py in get_response, line 68
> 
> Traceback (most recent call last):
> File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in
> get_response
>   68. callback, callback_args, callback_kwargs =
> resolver.resolve(request.path)

Does the same URL work if you aren't using Selenium? I'm trying to trim
down the problem to something smaller.

I *suspect* there is a problem in your URL configuration and you have
made a typo there. But that would mean that the URL would not work even
if you accessed it directly in the browser, without being under
Selenium's control, too.

If you can make it occur manually, can you post your URL configuration?
We might be able to see the problem.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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 and jQuery Autocomplete Routing Help

2007-03-08 Thread limodou

On 3/9/07, johnny <[EMAIL PROTECTED]> wrote:
>
> I am new to python and javaScript, I have created a funtion that
> return the tags via ajax.  I tried to replicate the php example.  But
> it's not working.  I doesn't return any tags back to my html page via
> ajax.  I need some help.  I am using jQuery autocomplete plugin from
> here: 
> http://just-tech.blogspot.com/2006/12/jquery-tweaking-auto-complete-plugin.html.
> Here is my function in view:
>
> def tag_autocomplete(request):
> #$q = $_GET['q'];
> #foreach($countries as $country) {
> #if(eregi("^".$q, $country)) {
> #echo $country."\r\n";
> #}
>
> s = request.GET.get('q', '')
> current_tags = list(Tag.objects.all())
> for tag in current_tags:
> if (search (s.lower(), tag.normalized_tag)):
> print "%s" % (tag.normalized_tag)
>
For django, just print won't return the result, but print output in
the console(if you are using develping server), you should return a
HttpResponse() object, and the good format of the returned data is
json, so there is a example from your code:

from django.utils import simplejson

s = request.GET.get('q', '')
#current_tags = list(Tag.objects.all())
result = []
for tag in Tag.objects.filter(name=s):
#if (search (s.lower(), tag.normalized_tag)):
#print "%s" % (tag.normalized_tag)
result.append(tag.normalized_tag)
return HttpResponse(simplejson.dumps(result))

If you are using Firefox and installed Firebug plugin, you can see the
response message.


-- 
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou

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



Please Remove My Email Address From Django Users

2007-03-08 Thread John A. Miller

To whom it may concern,

I'd registered last year in the Django users group at
Google.  After MUCH email, and little time yet to
explore Django, I removed my id from the group.  

But I'm still getting 20 to 40 group email copies a
day.

Please, remove my id and address from the Django users
group.

Thank you.

John Miller

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



RadioSelect attrs

2007-03-08 Thread sorrison

I am working with newforms and am wanting to set the class of the 
produced with a ChoiceField using a RadioSelect widget. I assume it
should be something like this..

field = forms.ChoiceField(choices=CHOICES,
widget=forms.RadioSelect(attrs={'class': 'fun'}))

output would be

Field:

 Choice 1
 Choice 2 


etc.

Can anyone help or does this need to be a feature request?

Thanks,
Sam


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



[ANN] We have telugu

2007-03-08 Thread Kenneth Gonsalves

hi,
am pleased to announce that django now has telugu. Also i note that  
the other day, kannada support was also added. These are the 3rd and  
4th Indian languages to be added - 4 down 18 to go. Thanks to  
pavithran for telugu and the sampaada group for kannada.
-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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