Model inheritance

2006-12-13 Thread Crispin Bennett
My first experiment with Django is a kind of wiki that involves being able to add a variety of different types of pages, each with their own set of fields. The obvious way to do this would be to create a base model page class which various page types inherit. But I can't imagine how the Django

Re: Odd behavior using __range lookup

2006-12-13 Thread Jeff Triplett
If anyone else stumbles on this post and has a similar problem then it's worth noting that the value field was a varchar doing an numeric range evaluation on it. Even though it does in fact work some times (mysql), you're better off hooking the save() method on a model and converting the value

Re: ImageField: Unique with number, not underscore?

2006-12-13 Thread DavidA
oliver.lavery wrote: > > class Photo( Model ) > def save( self ): > c = Photo.objects.all().filter( name = self.name ).count() > if c > 0: > self.name += '_' + str( c + 1 ) > Model.save( self ) This won't work as you expect. The first file named 'foo' will be saved

Re: How do I make a self-referential Many to Many relationship optional?

2006-12-13 Thread Austin Govella
And for the record, blank=True does make it not required. :-) Thanks guys! -- Austin Govella Thinking & Making: IA, UX, and IxD http://thinkingandmaking.com [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Django on a server with thin clients

2006-12-13 Thread Todd O'Bryan
Ooh. That's a great idea. I'd been meaning to try to move the test database to SQLite anyway. Thanks! On Wed, 2006-12-13 at 16:29 -0800, Joseph Heck wrote: > You can avoid the test database issue by having the students use > SQLite as the database backend. They can store the database in

Re: Problem setting up a separate media server

2006-12-13 Thread Joseph Heck
Good point - done. http://code.djangoproject.com/wiki/CookBookUsingExternalMedia -joe http://www.rhonabwy.com/wp/ On 12/13/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > > On 12/13/06, Joseph Heck <[EMAIL PROTECTED]> wrote: > > We're using > > > > blah blah blah > ... > > And then in the

Re: Django on a server with thin clients

2006-12-13 Thread Joseph Heck
You can avoid the test database issue by having the students use SQLite as the database backend. They can store the database in their home directories and be good to go. -joe On 12/13/06, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > > This is going to sound like an odd question, but I'm hoping

Re: ImageField: Unique with number, not underscore?

2006-12-13 Thread oliver.lavery
I don't know about horrible, it depends what you're going for. I was sort of suggesting that the default behaviour for file fields and image fields is wrong, and changing it fundamentally would be the way to go. Overriding save() is much cleaner, you're right. But I don't think the test should

Django on a server with thin clients

2006-12-13 Thread Todd O'Bryan
This is going to sound like an odd question, but I'm hoping people will have some ideas. I teach CS in a high school, and next semester my lab is going to be replaced with a thin client lab running on Ubuntu. My seniors and I are working on a Django project and will all be trying to run the

Re: ImageField: Unique with number, not underscore?

2006-12-13 Thread Terji7
Oliver Lavery wrote: > It seems that the most obvious way would be to alter _save_FIELD_file in > django/db/models/base.py ~ line 335. > > Relatively trivial patch, you'd just need to add an accumulator to the while > loop, afaict. > > Naturally there may be horrid consequences I haven't thought

Re: How do I make a self-referential Many to Many relationship optional?

2006-12-13 Thread Russell Keith-Magee
On 12/14/06, Austin Govella <[EMAIL PROTECTED]> wrote: > blank=TRUE returns an error: > "name 'TRUE' is not defined" Oh.. and the obvious error here - The Python boolean truth symbol is 'True', not 'TRUE' - the error you are getting is because the symbol TRUE is undefined. Yours, Russ Magee %-)

Re: How do I make a self-referential Many to Many relationship optional?

2006-12-13 Thread Russell Keith-Magee
On 12/14/06, Austin Govella <[EMAIL PROTECTED]> wrote: > > How do I make the self-referential Many to Many relationship optional? Um... m2m relationships are optional by definition. A ManyToMany field sets up an intermediate table, but adds nothing to the model table itself. You are not required

Re: Getting values from a drop-down menu

2006-12-13 Thread Massimiliano Ravelli
Matt Williams wrote: > > A > but I keep getting an error about an empty MultiValuedDict {}, which I > think means that I'm not getting the values back. Try: A ... and then read request.POST['letter'] Massimiliano --~--~-~--~~~---~--~~ You received this

Re: Return and continue processing?

2006-12-13 Thread Russell Keith-Magee
On 12/14/06, Noah <[EMAIL PROTECTED]> wrote: > > If I have a fairly intensive view, is there a way to return the > response (ie a thank you) and continue doing my number crunching? The only way to do this would be to use your view code to start a thread and do your processing in the thread, with

Re: How do I make a self-referential Many to Many relationship optional?

2006-12-13 Thread Massimiliano Ravelli
Austin Govella wrote: > How do I make the self-referential Many to Many relationship optional? Try to add "null=True". Massimiliano --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Getting values from a drop-down menu

2006-12-13 Thread Matt Williams
Dear All, I'm a newbie with Django, and have what is probably a very simple question. I'm trying to get the values from an html drop-down form. I've got a form like this: A B C D E with a method in views.py: ansQuestion(request): q = get_object_or_404(Question) answer =

Re: Changemanipulator and follow true

2006-12-13 Thread Massimiliano Ravelli
[EMAIL PROTECTED] wrote: > I have to keep the Address on Company... as Address will be being used > in other places as well..and is not always related to a company... I > have a Property and User classes as well..and each of them will have an > Address foreign key. Well, I think we'll have to

Re: Admin login problem

2006-12-13 Thread Yatla
Jorge, Many thanks! I was using an .htaccess in the subdirectory, but did not have the subdirectory specified after the fcgi file in the last rewrite rule. I don't know much about this so just copied from a tutorial on this that did not have the subdirectory in the rewriterule. Thanks again!

Re: help with tagging app

2006-12-13 Thread [EMAIL PROTECTED]
Rob Slotboom wrote: > I installed Luke Plant's Tagging App and started reading the README > file and the comments provided in the source. Compared to the marvelous > Django Book and -tutorial this reading isn't very funny :-) > > Has someone a simple example for how to include a tag in another

MTM intermediate table data in admin interface...

2006-12-13 Thread Daniel Jewett
Hello all, I have this setup (stripped): class Album(models.Model): title = models.CharField(maxlength=255) ... class Person(models.Model): first_name = models.CharField(maxlength=50, blank=True) last_name = models.CharField(maxlength=100) ... class Performance(models.Model): album =

Re: ImageField: Unique with number, not underscore?

2006-12-13 Thread Oliver Lavery
It seems that the most obvious way would be to alter _save_FIELD_file in django/db/models/base.py ~ line 335. Relatively trivial patch, you'd just need to add an accumulator to the while loop, afaict. Naturally there may be horrid consequences I haven't thought of ;) Cheers, ~ol On 12/13/06,

ImageField: Unique with number, not underscore?

2006-12-13 Thread [EMAIL PROTECTED]
Hi. I'm using ImageFields in my portal application and allowing people to upload their photos. Since digital camera software creates rather predictable file names, I've now got loads of files like this: PICT0006.JPG PICT0006_.JPG PICT0006_.jpg PICT0006__.JPG PICT0006__.jpg PICT0006___.JPG

Re: Problem setting up a separate media server

2006-12-13 Thread Tipan
Thanks all - that makes a lot more sense now. It was definately a case of me looking for too simple a solution in the first place. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Changemanipulator and follow true

2006-12-13 Thread Carole Zieler
Hi Massimiliano, I hope you don't mind my emailing you directly... I sent a reply on the groups... but thought I'd send it directly to you as well... since you seem to be using this technique... In my form I'm using the following ( I tried putting a 0 in there like your sample..but it gave an

Re: Django email

2006-12-13 Thread Reinhard Knobelspies
For your requirements OpenEMM might be a better solution: http://www.openemm.org/home.html . Reinhard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-13 Thread Waylan Limberg
On 12/13/06, Bob <[EMAIL PROTECTED]> wrote: > > Don - > > How do I check the revision? import django; django.__version__ prints > '0.95' but not the revision number. On the command line from within your django_src directory do: svn info That should tell you the revision number among other

Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-13 Thread Bob
Don - How do I check the revision? import django; django.__version__ prints '0.95' but not the revision number. I just updated from svn with: svn co http://code.djangoproject.com/svn/django/trunk/ but I still get the same behavior - manage.py doesn't know about "test". Thanks, Bob On Dec

Return and continue processing?

2006-12-13 Thread Noah
If I have a fairly intensive view, is there a way to return the response (ie a thank you) and continue doing my number crunching? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: caching when multiple domains point to the same server

2006-12-13 Thread Fredrik Lundh
Fredrik Lundh wrote: > how do I troubleshoot this? by hitting myself in the head with a suitable object, obviously. (when using CACHE_MIDDLEWARE_ANONYMOUS_ONLY, make sure you're logged out when testing cache behaviour...) --~--~-~--~~~---~--~~ You received

caching when multiple domains point to the same server

2006-12-13 Thread Fredrik Lundh
hi, I've just set up a django server which is currently available through multiple domain names, and I just noticed that caching only works for one of the domains. what have I missed? how do I troubleshoot this? (I'm using 0.95 on the deployment server, btw)

Sitemaps and generic views

2006-12-13 Thread [EMAIL PROTECTED]
I kinda asked the before, but maybe I wasn't clear. I know you can use sitemaps with an object_detail generic view, and applaud the developers for how easy it is to do so. But how do you use them with an .object_list view? In particular, the genericSitemap, or in general?

Re: Help with get absolute url

2006-12-13 Thread conrad22
Mmm...I actually got it to work in the category_detail template: {% for organisation in object.organisation_set.all %} {{organisation.org_name}} {% endfor %} Each category does return a list of the organisations that are in it, but what I need to do is then simply provide access

Re: Changemanipulator and follow true

2006-12-13 Thread [EMAIL PROTECTED]
Ok..this is what I've changed it to... but it's still not displaying an edit box for my street numberI'm using the Company changemanipulator... In my form I'm using the following ( I tried putting a 0 in there like your sample..but it gave an unindexable object error ) Street #:{{

Re: Changemanipulator and follow true

2006-12-13 Thread Massimiliano Ravelli
[EMAIL PROTECTED] ha scritto: > I'm not using the admin interface though...will this work with that? > (I'll give it a shot and see) edit_inline argument works well with both admin interface and custom views (I'm using the latter). Massimiliano

Re: Changemanipulator and follow true

2006-12-13 Thread [EMAIL PROTECTED]
Hmm... I have to keep the Address on Company... as Address will be being used in other places as well..and is not always related to a company... I have a Property and User classes as well..and each of them will have an Address foreign key. I'd like to be able to show a form for Property and

Re: Changemanipulator and follow true

2006-12-13 Thread [EMAIL PROTECTED]
I'm not using the admin interface though...will this work with that? (I'll give it a shot and see) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Problem setting up a separate media server

2006-12-13 Thread Jeremy Dunck
On 12/13/06, Joseph Heck <[EMAIL PROTECTED]> wrote: > We're using > > blah blah blah ... > And then in the settings.py under TEMPLATE_CONTEXT_PROCESSORS, we added: >"myproject.context_processors.common", > > There may well be a much better way to accomplish this all, but that worked > out

Re: Admin login problem

2006-12-13 Thread Jorge Gajon
On 12/12/06, Yatla <[EMAIL PROTECTED]> wrote: > > Newbie here - saw that the same question was asked earlier but not > answered, and the post was locked so I could not reply. > > I have a Django site in a subdirectory as follows (via fcgi) - (using > ver 0.96 pre via svn) > >

Re: Problem setting up a separate media server

2006-12-13 Thread Joseph Heck
What you want to use in your template is a reference to the media URL prior to the static images. We're using blah blah blah blah.. It generally requires a bunch of search & replace for the first time you implement it, and then just remembering to reference the {{media_url}} thereafter as you

Re: Problem setting up a separate media server

2006-12-13 Thread Waylan Limberg
On 12/13/06, Tipan <[EMAIL PROTECTED]> wrote: > > > > On Dec 13, 1:58 pm, "Waylan Limberg" <[EMAIL PROTECTED]> wrote: > > On 12/13/06, Tipan <[EMAIL PROTECTED]> wrote: > > > > http://192.168.1.9:3000/gobites.jpg;> > > > > Generally speaking I believe the conventional way to do this when both > >

Re: Problem setting up a separate media server

2006-12-13 Thread Tipan
On Dec 13, 1:58 pm, "Waylan Limberg" <[EMAIL PROTECTED]> wrote: > On 12/13/06, Tipan <[EMAIL PROTECTED]> wrote: > > http://192.168.1.9:3000/gobites.jpg;> > > Generally speaking I believe the conventional way to do this when both > servers are on one machine is to point all traffic to the static

Documentation - supported parameter lists

2006-12-13 Thread Dirk Eschler
Hello, i really like the documentation intergration in Django's admin interface. I'm wondering how to document parameters though. I've tried using ReST for my classes and functions as described below, but :Parameters: doesn't seem to be recognized. http://epydoc.sourceforge.net/fields.html

Re: security and connection to db

2006-12-13 Thread Jeremy Dunck
On 12/13/06, Sandro Dentella <[EMAIL PROTECTED]> wrote: > > > I'm developing an application in which different users should see different > data, I'd like to enforce this in the db rather that in the application. How > can I bypass the username/pass in settings.py with username/pass provided by >

Re: Problem setting up a separate media server

2006-12-13 Thread Waylan Limberg
On 12/13/06, Tipan <[EMAIL PROTECTED]> wrote: > > However, I can't seem to get an simple image to display through a > Django template. > > I've tried all sorts of combinations and can't seem to make any > headway. > > Any advice welcome. Details of my settings etc. below. > > Template call is

Re: Help with get absolute url

2006-12-13 Thread Waylan Limberg
On 12/13/06, conrad22 <[EMAIL PROTECTED]> wrote: > > Yes, I know. Sorry, should have been more specific: > the problem is, that the second part of the url pattern comes from a > different model. > > I've tried > (r'^categories/(?P\d+)/(?P\w+)/$','django.views.generic.list_detail.object_detail', >

Re: How to change the representation of newline?

2006-12-13 Thread Aidas Bendoraitis
It might be that it treats new lines as \r\n when you are using some windows-* encoding for your html pages. Check the source code. I would rather use UTF-8 in any case. Regards Aidas Bendoraitis [aka Archatas] On 12/13/06, zhongke chen <[EMAIL PROTECTED]> wrote: > thanks a lot. problem fixed

Problem setting up a separate media server

2006-12-13 Thread Tipan
I need some advice on configuring a separate media server for our jpeg images. We are running Django on Apache 2.2 with mod_python 3.2.10 (python2.5) on a Windows 2003 server. As recommended in the docs, I am setting up a separate web server to serve the media. I've installed Lighttpd 1.4.13

Re: send_mass_mail() on save

2006-12-13 Thread Adam Fast
You'll want to look into the save and delete hooks functionality here: http://www.djangoproject.com/documentation/models/save_delete_hooks/ What it would look like is add to Publications: def save(self): super(Publications, self).save() # Call the "real" save() method

Re: How to change the representation of newline?

2006-12-13 Thread zhongke chen
thanks a lot. problem fixed as you said. I use Firefox under linux. does it treat newline as \r\n?? On 12/11/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote: > It seems that your browser treats new lines as under dos/windows. Is > it Konqueror? > > I would suggest you to override the save method

security and connection to db

2006-12-13 Thread Sandro Dentella
I'm developing an application in which different users should see different data, I'd like to enforce this in the db rather that in the application. How can I bypass the username/pass in settings.py with username/pass provided by the user? Is that any possible? Are there functions to connect as

Re: forms and one-to-many relationships

2006-12-13 Thread MerMer
Mathew, I think you need to look at "Signals". It's an implementation of Pydispatcher. Basically, you register your signal to a particular object. Whenever that object is about to be changed the signal is sent and your code is runt. There is a "Pre-Save" state which should allow you to

Re: alternatives to edit_inline

2006-12-13 Thread Rob Slotboom
Hi Milan, > Is there a workaround for that? Sorry I don't know. >I'll write my own views. Maybe you can expand the admin using your own views. Take a look at the next app for some ideas: http://trac.dedhost-sil-076.sil.at/trac/filebrowser/wiki Success. Rob

Re: alternatives to edit_inline

2006-12-13 Thread Rob Slotboom
Hi Milan, > Is there a workaround for that? Sorry I don't know. >I'll write my own views. Maybe you can expand the admin using your own views. Take a look at the next app for some ideas: http://trac.dedhost-sil-076.sil.at/trac/filebrowser/wiki Success. Rob

Re: forms and one-to-many relationships

2006-12-13 Thread [EMAIL PROTECTED]
Hi. Im not sure, but i guess You are using generic views. If yes, make a wrapper of your view, and put that code in that wrapper function. Besides overriding save of the model works fine. But i personally would put such code in my own form manipulator, you keep clean views and your model also.

Re: Help with get absolute url

2006-12-13 Thread conrad22
Yes, I know. Sorry, should have been more specific: the problem is, that the second part of the url pattern comes from a different model. I've tried (r'^categories/(?P\d+)/(?P\w+)/$','django.views.generic.list_detail.object_detail', info_dict), but it's obviously not quite there...? How would I

Re: Catching m2m chnages

2006-12-13 Thread [EMAIL PROTECTED]
coulix wrote: > last time i look at it they were no solutions :/ Yeah i had the same problem. I needed some logging mechanism to trace all changes in DB (also in m2m relations). The solution i did take was application specific. I don't think that django provides any hookups for such actions.