Re: Calling model-functions in template

2006-12-03 Thread Ivan Sagalaev
Kai Kuehne wrote: > models.py: > def genres_title_list(self, separator=', '): > return separator.join([x.title for x in self.genres]) If I reconstruct the case correctly and `genres` is a relation to child objects with ForeignKey to a Movie then `self.genres` by default should look

Re: Calling model-functions in template

2006-12-03 Thread Kai Kuehne
Hi, On 12/3/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > Kai Kuehne wrote: > [model.py] > > If I reconstruct the case correctly and `genres` is a relation to child > objects with ForeignKey to a Movie then `self.genres` by default should > look like `self.genre_set.all()`. Otherwise it will rai

Right way to use this ForeignKey

2006-12-03 Thread phess
I'm stuck at what I think should have been one of the easiest steps of building my magazines website: the models. :( I really feel stupid for that, so please tell me the right way to do this. This is what I have: Magazines, with many Issues each, and articles, which belong to only one Magazine, a

Re: Right way to use this ForeignKey

2006-12-03 Thread Todd O'Bryan
So an article can be in more than one issue of a magazine? My guess is that each article only appears in one issue. If that's the case, you should only have the issue as a foreign key. The problem there is that you may be annoyed that the issue is something like "June 2004". Just override the iss

Re: Right way to use this ForeignKey

2006-12-03 Thread phess
> So an article can be in more than one issue of a magazine? Not at all. The Article belongs to only one Issue, which is what I want the ForeignKey to mean. I just want to limit the choices of Issues to the ones that make sense, i.e. to the Issues that belong to the chosen Magazine. > Just over

Re: Right way to use this ForeignKey

2006-12-03 Thread Todd O'Bryan
If an issue belongs to only one magazine and an article belongs to only one issue, then including both the magazine and the issue in the article model is redundant, so if you can avoid it, I would. On the other hand, I see your point that being able to quickly find the right issue when you have e

Re: Right way to use this ForeignKey

2006-12-03 Thread phess
Right, thanks a lot, Todd. I guess I'm not *that* stupid after all... :) Phew! :D I think I was actually using the wrong approach to building the magazines. I mean, they should have been separate apps from the start. Or else, every freaking article will be in a huge database table that also house

Re: Fast fcgi on dreamhost --> shauwn of the dead, help me shoot zombies

2006-12-03 Thread Maciej Bliziński
coulix napisał(a): > Any idea on how to fix these problems on dreamhost? I'm not sure if what you're currently experiencing is the same problem I had few days ago. I did notice zombie processes and my Django app on Dreamhost was down every now and then. I've solved this problem by renaming django

DB Syncing Models

2006-12-03 Thread marksibly
Hi, What's the 'right' way to update the database when you change a model? For example, when you add a new field? I initially thought 'manage.py syncdb' would detect and handle this for you, but it doesn't appear to. Currently, I'm using MySql to 'DROP TABLE' and then using 'manage.py syncdb' a

File downloads

2006-12-03 Thread marksibly
Hi, I have a django 'files' app that simply maps 'virtual' file names to physical files for downloading. Currently, I'm getting the view to return a HttpResponseRedirect to a 'files' area, but I don't like this as it means the files are 'publicly' available and I'd like everything to go through

Re: Best way to run a seperate media server on same machine as Django?

2006-12-03 Thread Brandon Warren
Thanks for the replies! Because another IP addr isn't available, I decided to run Lighty on port 81. I don't need SSL, so that seemed like the best solution, and it's working well for me. -Brandon --~--~-~--~~~---~--~~ You received this message because you are

Re: File downloads

2006-12-03 Thread Ivan Sagalaev
marksibly wrote: > I couldn't find a 'HttpResponseStaticFile' class or anything, so what > other options do I have? You can pass an open file to a usual HttpResponse: f = open(filename, 'rb') return HttpResponse(f, mimetype='application/octet-stream') > Also, how efficient would it be

Re: File downloads

2006-12-03 Thread marksibly
Hi, Thanks for that! Another option I've found is to use mod_python's 'sendfile()' method in req. However, I'm having a problem using Django within a 'plain' mod_python handler - I get the 'DJANGO_SETTINGS_MODULE' not found error as soon as I try to import my models. I've copied the apache co

Re: File downloads

2006-12-03 Thread marksibly
Found it in the FAQ; [quote] If you're using mod_python but not using Django's request handler, you'll need to work around a mod_python bug related to the use of SetEnv; before you import anything from Django you'll need to do the following: os.environ.update(req.subprocess_env) [/quote] --~--~

Re: File downloads

2006-12-03 Thread Graham Dumpleton
marksibly wrote: > Found it in the FAQ; > [quote] > If you're using mod_python but not using Django's request handler, > you'll need to work around a mod_python bug related to the use of > SetEnv; before you import anything from Django you'll need to do the > following: > > os.environ.update(req.s

Re: Session problems

2006-12-03 Thread Graham Dumpleton
Jakub Labath wrote: > Hi All, > > Sorry for being quiet for a while just got back from a vacation. > > > > > Hi Jakub, > > > > Do you have any updates on this problem? Was it a mod_python bug? > > > > Adrian > > > > No the problem persists and I noticed that my coworkers have not > resolved this

Question concerning generic views or date based views in general

2006-12-03 Thread Oliver Andrich
Hi, I am currently developing a small Django application for my personal use. Now I like to have a date based archive page, and I thought that this finally is a good thing to look into generic views. My requirements are, that I can display the actually database item on the page and in a side bar a

Re: DB Syncing Models

2006-12-03 Thread Russell Keith-Magee
On 12/4/06, marksibly <[EMAIL PROTECTED]> wrote: > > > I initially thought 'manage.py syncdb' would detect and handle this for > you, but it doesn't appear to. No - Syncdb will add any completely new model, but will not alter any existing model. The behaviour you are seeking is under development

Re: Fast fcgi on dreamhost --> shauwn of the dead, help me shoot zombies

2006-12-03 Thread [EMAIL PROTECTED]
I just got fed up and fired Dreamhost. They're FCGI implementation is just too flakey for a production site. To their credit, they try to warn people about using Django, but being on the list of friendly hosts and kinda-sorta supporting it give another impression. Personally, I think they should

Re: Multithreading inside django

2006-12-03 Thread Wolfram Kriesing
Btw I found the problem ... details are here http://wolfram.kriesing.de/blog/index.php/2006/multithreading-with-mysqldb-and-weakrefs On 12/2/06, Wolfram Kriesing <[EMAIL PROTECTED]> wrote: > django/db/__init__.py contains > dispatcher.connect(connection.close, signal=signals.request_finished) > >

Pagination variable problem with generic list and limited queryset

2006-12-03 Thread Silas
I have a problem with generic.list_detail.object_list, a limiting queryset, and pagination variables. For some reason when I use the code below, results are restricted to the sliced 100, but all the pagination variables show results as if the slice wasn't there. Example: {{ pages }} = 12 (not t

Hiding Referrer URL

2006-12-03 Thread Siah
Hi, I need to hide referrer url on HttpResponseRedirect. I was expecting to find something like ReferrerURL in HttpResponseRedirect.headers, but did not. I was hopping to change the header information right before HttpResponseRedirect sends the user to the other server to hide the referrer URL, o

High Load

2006-12-03 Thread [EMAIL PROTECTED]
We're trying to launch our Django site, and we're coming into severe load issues. The site right now has 2 SQL servers, clustered, and 3 web servers all running with 4 cores and 4 gigs of memory. Our biggest problem is everything seems ok on the development site, load times are ok, the SQL queri

Sort by related table

2006-12-03 Thread fvk
There are my two models: class Messages(models.Model): sender = models.ForeignKey(UserProfile) to = models.ForeignKey(UserProfile) body = models.TextField() sent_date = models.DateTimeField() class UserProfile(models.Model): contactlist = models.ManyToMa

Setting checkbox to check as default value

2006-12-03 Thread jeffhg58
I have a custom manipulator and I am trying to set the checkbox default to checked. For example, my field name is: forms.CheckboxField(field_name="current"), Not sure how you to do it. I tried putting the attribute after the field name which did not work. I also tried right before the formwrap

Help with Django Admin and models - editing multiple related tables "inline" on one form

2006-12-03 Thread dmlee
Hi All, I'm creating an application to track field-trial results for hounds. Does anyone know of an easy way to edit multiple related tables inline on one form in the Admin app? Ideally, I want the hound "Groupings" edited inline with trials (which works as expected), but I also want the "Standi

Validation 3 steep complicate form

2006-12-03 Thread GvaderTh
Hello All. I read django documentation about forms, had seek internet and didn't found solution for situation like this: I have order form divided to 3 steeps, after every step should be validation and if validation is succesfull, user can fill form for next-step. Form for every step doesn't map

email not going to bulkfolder

2006-12-03 Thread John
hi guys i have added a few viral features such as email friends, refer, share item etc... but the problem is the email gets delivered to bulk folder by gym... please tell me how to ensure that emails dont get delivered to bulk folder thanks John --~--~-~--~~~---~--~-

How to default checkboxfield in customer manipulator

2006-12-03 Thread jeffhg58
I am trying to set the checkboxfield default value to checked but not sure how you do it. Here is my formfield for the checkbox forms.CheckboxField(field_name="current"), I tried ading checked="checked" but that did not work. Thanks, Jeff --~--~-~--~~~---~--~~

Run your Django app with the CherryPy server

2006-12-03 Thread Loïc (titoo)
Hello, For interested people, I have wrapped the WSGI CherryPy server to be used with Django. With the same wrapper you can start several django projects (one cherrypy instance per project) with a configuration file for each project. You can ask it to serve the Django admin media files or not, it

no-database models?

2006-12-03 Thread [EMAIL PROTECTED]
Hi, Is there a way to use regular home-spun python models in such a way that they'll relate with Django's ORM models? What I'd like to do is something like this: class MyDay: def __init__(self, date): self.id = date.toordinal()

Re: no-database models?

2006-12-03 Thread Russell Keith-Magee
On 12/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Of course, I could just run out 10 years worth of days in a > database table to get the same effect, but that seems like a kludge. As > does every other method of tackling this particular problem that I've > been able to come up w

Re: no-database models?

2006-12-03 Thread [EMAIL PROTECTED]
Russ, Because it seems like the cleanest way of pulling together a wide variety of content that all pertains to a particular day, or list of days. The alternative, it seems to me, is running seperate queries on Concerts, Meetings, DrinkSpecials, BallGames, etc., then passing all of

Re: email not going to bulkfolder

2006-12-03 Thread James Bennett
On 12/3/06, John <[EMAIL PROTECTED]> wrote: > but the problem is the email gets delivered to bulk folder by gym... > please tell me how to ensure that emails dont get delivered to bulk > folder There isn't, really. Whether an email provider filters your messages into a user's "bulk" or "spam" fol

Re: no-database models?

2006-12-03 Thread [EMAIL PROTECTED]
The other part, which I forgot to mention, is that I'd like to be able to have an easy many-to-many relationship between days and, say, meetings. A particular meeting can happen every other Tuesday, and it seems a waste to have to enter a new record for it twice a month. Hank --~--~-

Re: no-database models?

2006-12-03 Thread Russell Keith-Magee
On 12/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Russ, > > Because it seems like the cleanest way of pulling together a wide > variety of content that all pertains to a particular day, or list of > days. > The alternative, it seems to me, is running seperate queries on

Re: no-database models?

2006-12-03 Thread Russell Keith-Magee
On 12/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > The other part, which I forgot to mention, is that I'd like to be > able to have an easy many-to-many relationship between days and, say, > meetings. A particular meeting can happen every other Tuesday, and it > seems a waste to h

Re: no-database models?

2006-12-03 Thread [EMAIL PROTECTED]
> context = TemplateContext( > dict([('todays'+model.name, model.objects.filter(date=date.today())) for > model in [Concerts, Meetings]]) That's some awesome smart list-comprehension mojo, and I'll definitely be ripping it off. But I guess it doesn't quite answer my wish for a many-

Re: no-database models?

2006-12-03 Thread [EMAIL PROTECTED]
We're driving right past each other on the information superhighway. Thanks for your advice, Russ. It still seems to me that a many-to-many relationship between days and events would be desirable, for the same reasons that all many-to-many relationships are desirable. In my case, I

Re: Hiding Referrer URL

2006-12-03 Thread Jacob Kaplan-Moss
On 12/2/06 6:01 PM, Siah wrote: > How can I accomplish that? You can't; the Referer header gets set by the browser, not by the web server. Jacob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group

Re: using manipulators without defining fields again

2006-12-03 Thread Milan Andric
On Dec 1, 1:31 pm, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > To not invent an artificial example could you describe your task in more > detail? Sure, I have a long application form for a workshop (name, employment, resume, ... 65 fields). The user logs in to the site via django.contrib.auth.vi