Complex query in model manager

2009-08-22 Thread CrabbyPete
I have the following code in model manager class SpotMessageManager(models.Manager): def for_user(self, user, start = 0, end = None, friends ): messages = self.filter(user = user).order_by ('date_added').reverse() ... friends is a list of users, and I want the

Django ORM and Google Gears (or alternatives?)

2009-08-22 Thread Victor Hooi
heya, I've got a small project involving an ordering system web application. One of the requirements is offline functionality (i.e. it will function without a direct internet connection, at least on a limited scale - e.g. they can search their previous orders, and submit orders, with a cached

Re: Path issue with tinymce and MEDIA_ROOT

2009-08-22 Thread zignorp
Thanks for replying, Joost, I tried changing my settings to mirror the settings of someone else in a previous tiny mce post: So I moved the files. In the "mycode" directory, which contains my project "mysite" dir, as well as one I created called "static_media" which has js/tiny_mce, etc. in

"bridge" 2 django websites/projects

2009-08-22 Thread kaftana
Hi , I have 2 separate django websites/projects. They also have some common reusable django apps. I would like to "bridge" these 2 websites so as one is the maindomain.com and the other appears as a subdomain.maindomain.com. In main domain there will be a href and hence redirected to

how to implement two dimension formsets

2009-08-22 Thread lzhshen
Problem description: Suppose there is an ExercisePlan record (set=3, reps=12), which means that this exercise should be done with 3 sets and the trainer suggests to repeat the exercise about 12 times in each set. Here is the ExercisePlan table data in db: id | sets | reps

Re: Specific fields in 'select'

2009-08-22 Thread Andrea Zilio
I think this is what you need: http://docs.djangoproject.com/en/dev/ref/models/querysets/#only-fields On Aug 22, 1:43 pm, Hanpan wrote: > Am I right in saying that .values() won't span across joins though? I > have a many-to-many field which I would like to retrieve

Re: Dynamically add a line to an inlineformset

2009-08-22 Thread Andew Gee
Well...I don't know what happened but I have put my loop back in and now it works. I cannot get the problem to reproduce. I must have had something out of place but I don't know what, but it works now which is what I need. So again thanks for your help. Andrew On Aug 22, 7:27 pm, Andew Gee

Reusable/plugable apps integrations best practices

2009-08-22 Thread Chris H.
So I'm trying to get my head around making my small, tightly focused apps reusable. I've done this, but right now still have "dependencies" between one another, that I'd like to remove. For simplicity sake, I have an Articles, Events, and Photos app. Right now each Article has a photos.photo

i18n - besides translation

2009-08-22 Thread hinnack
Hi, while translating a site, I wonder if there is something that keeps care of all national formats and encodeings like: - money symbol ( pre or post sign) - number format - date format - etc. -- Hinnack --~--~-~--~~~---~--~~ You received this message because

Re: How to run a static html page as a section of django website?

2009-08-22 Thread Bins
Done. thanks Heather and all of you who helped me achive when I was looking for.. Thanks a ton.. On Aug 22, 6:44 am, Heather wrote: > I think this is what you're looking for then... > > in your httpd.conf or httpd-vhosts.conf or wherever you set up django > in apache: > > >  

TypeError: execute() takes at most 3 arguments (4 given)

2009-08-22 Thread kevin
cursor.execute("SELECT a,b,c FROM Table_Name WHERE a = %s AND b = %s ", [string1],[string2]) gives me the following error: TypeError: execute() takes at most 3 arguments (4 given) Where did i go wrong? --~--~-~--~~~---~--~~ You received this message because you

Re: ModelForm and ForeignKeys

2009-08-22 Thread Ryan Bales
I have experienced this same issue, and that link didn't really help. I am trying to hook into a legacy database using "inspectdb", and I can't index the tables. class Character(models.Model): guid = models.IntegerField(primary_key=True) name = models.CharField() ... ...

Re: Template Filters

2009-08-22 Thread WilsonOfCanada
For reference: http://google-ctemplate.googlecode.com/svn/trunk/doc/auto_escape.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Another (hopefully) simple question

2009-08-22 Thread Daniel Roseman
On Aug 22, 7:35 pm, Robb Bossley wrote: > Daniel, > > I appreciate the time you took to answer. > > I could do this, but I have a number of views that the user will have the > option of selecting on this resulting page, so I would have to keep passing > it as a GET

Re: newbie help: how to list, list, detail

2009-08-22 Thread Daniel Roseman
On Aug 22, 8:29 pm, justin jools wrote: > key is used in replacement of 'id' in Google app engine (patch) > Essentially this doesnt matter, assume it is id in normal django. > I would just like to know how to do a list, list, detail query. When I > pass the id from

Re: Test server and Https

2009-08-22 Thread Vitaly Babiy
Alright, thanks Vitaly Babiy On Sat, Aug 22, 2009 at 12:31 PM, Andy McKay wrote: > > > On 22-Aug-09, at 7:50 AM, Vitaly Babiy wrote: > > > Hey, > > I am working on a site that part of it must be behind HTTPS, is > > there any I can run this using the test server? > > The

Can anyone give a method/example for doing drill down category queries: list, list, list detail

2009-08-22 Thread justin jools
Can anyone give a method/example for doing drill down category queries: list, list, list detail I'm writing car database. With make, type, model as seperate tables. model containing all the details. essentially 1st choice could be: make: Audi, BMW, Ford 2nd BMW: 200 series, 300 series... 3rd

Re: newbie help: how to list, list, detail

2009-08-22 Thread justin jools
key is used in replacement of 'id' in Google app engine (patch) Essentially this doesnt matter, assume it is id in normal django. I would just like to know how to do a list, list, detail query. When I pass the id from first list to query a second list in a different table: i.e. first list/table

Re: Bulk data insert

2009-08-22 Thread Benjamin Sergeant
Agreed, not sure my suggestion will help you. You can have a look at turning off transaction, that might make your code faster but I'm really not sure. ( Check-out those from django.db import transaction @transaction.commit_manually ) - Benjamin On Thu, Aug 20, 2009 at 9:58 PM, Doug

Re: Another (hopefully) simple question

2009-08-22 Thread Robb Bossley
Daniel, I appreciate the time you took to answer. I could do this, but I have a number of views that the user will have the option of selecting on this resulting page, so I would have to keep passing it as a GET variable on subsequent requests. Any other thoughts? (I may end up doing this if I

Re: Another (hopefully) simple question

2009-08-22 Thread Daniel Roseman
On Aug 22, 6:55 pm, Robb Bossley wrote: > I have one more question to ask of all of you Django gurus - I hope it is > simple, though I think I have pulled most of my hair out trying to get this > down in my mind > > I have a form that displays four lookup values.  I would

Re: newbie help: how to list, list, detail

2009-08-22 Thread Daniel Roseman
On Aug 22, 6:08 pm, justin jools wrote: > how can I show a list then pass the id to next list lookup then > detail? > > basically I'm writing a car product database with make, type and model > tables: > > so first list is Audi, BMW, Ford... the next list is e.g. Audi

Another (hopefully) simple question

2009-08-22 Thread Robb Bossley
I have one more question to ask of all of you Django gurus - I hope it is simple, though I think I have pulled most of my hair out trying to get this down in my mind I have a form that displays four lookup values. I would like to append these values to the url (versus setting these variables as

Re: From a relative noob

2009-08-22 Thread Masklinn
On 22 Aug 2009, at 19:26 , Robb Bossley wrote: > Thank you all - I had not realized I could use the __gt feature. > > And I believe that you are right, Andy. > Also, note that you don't *have* to chain the `filter` calls: a single filter can take multiple arguments

Re: Cannot display images - need help with settings for development environment

2009-08-22 Thread robinne
I figured it out: #MEDIA_URL = 'http://localhost:8000/testproject/site_media/' MEDIA_URL = '/site_media/' On Aug 22, 8:57 am, robinne wrote: > I'm new to Django and I cannot seem to get all the settings correct to > allow me to view images in the development

Re: From a relative noob

2009-08-22 Thread Robb Bossley
Thank you all - I had not realized I could use the __gt feature. And I believe that you are right, Andy. Thanks again! Robb On Sat, Aug 22, 2009 at 12:30 PM, Andy McKay wrote: > > On 22-Aug-09, at 9:20 AM, Matthias Kestenholz wrote: > > Some.object.filter(id =

newbie help: how to list, list, detail

2009-08-22 Thread justin jools
how can I show a list then pass the id to next list lookup then detail? basically I'm writing a car product database with make, type and model tables: so first list is Audi, BMW, Ford... the next list is e.g. Audi models: T100, Quattro, then last selection is detail. I used this view model and

Re: Test server and Https

2009-08-22 Thread Andy McKay
On 22-Aug-09, at 7:50 AM, Vitaly Babiy wrote: > Hey, > I am working on a site that part of it must be behind HTTPS, is > there any I can run this using the test server? The built in django server does not do HTTPS. Use Apache or some other server to serve HTTPS -- Andy McKay

Re: From a relative noob

2009-08-22 Thread Andy McKay
On 22-Aug-09, at 9:20 AM, Matthias Kestenholz wrote: >> Some.object.filter(id = var1).filter(value = >> var2).extra(where=['Cost>%s'], params=['var4']) Follow Matthias advice, below. But for the record you've put 'var4', instead of var4, so you are passing a string which MS SQL doesn't

Re: From a relative noob

2009-08-22 Thread Matthias Kestenholz
Robb, On Sat, Aug 22, 2009 at 6:06 PM, Robb Bossley wrote: > In the course of writing this program, I have run into a challenge with > regard to the way that things are retrieved and displayed.  The problem is > as follows: > > #"var3" is passed in from the following >

Dates with varying specificity?

2009-08-22 Thread ringemup
Has anyone here ever written an application that needed to be able to take a date field where the month or day was sometimes but not always known? How would you handle this? Using separate day/month/year fields instead of a DateField seems to sacrifice a lot of convenience and usability.

From a relative noob

2009-08-22 Thread Robb Bossley
All, First of all, I would like to thank the developers of Django - this piece of software is truly genius! I am in the process of using Django to create a web portal for the international company that I work with. If accepted, it will mean that open source technologies are beginning to be

Cannot display images - need help with settings for development environment

2009-08-22 Thread robinne
I'm new to Django and I cannot seem to get all the settings correct to allow me to view images in the development environment. Here is what I know (I'm developing on Vista): For internal server to serve images, you have to configure django settings, so here is what I've done. [My actual path to

Re: http://jacobian.org/tags/ - Source?

2009-08-22 Thread Victor Hooi
heya, Yeah, I figured it was leveraging on django-tagging - awesome to hear they just made a new release as well =). I thought the project had stagnated or something...lol. However, I assume there's a bit more to his app - both in the entry side of things, as well as in the way it's

Test server and Https

2009-08-22 Thread Vitaly Babiy
Hey,I am working on a site that part of it must be behind HTTPS, is there any I can run this using the test server? Thanks, Vitaly Babiy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: ImageField woes

2009-08-22 Thread Léon Dignòn
If you need it only for one particular form, you can also override clean_(): --- import Image # PIL class UserProfileForm(ModelForm): class Meta: model = UserProfile # Model UserProfile has an ImageField named avatar. def clean_avatar(self):

Re: Specific fields in 'select'

2009-08-22 Thread Hanpan
Am I right in saying that .values() won't span across joins though? I have a many-to-many field which I would like to retrieve somehow. On Aug 22, 12:18 pm, Tim Chase wrote: > > How do I tell Django which fields to select from my database? It seems > > to always

overwrite and delete uploaded file

2009-08-22 Thread Shuge Lee
How to make it with nice way? I do override with stupid way: http://dpaste.com/83943/ Anyone have better idea? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: ModelForm and ForeignKeys

2009-08-22 Thread Léon Dignòn
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form Good luck! -ld On Aug 21, 3:49 pm, goobee wrote: > hi there > > I'm in dire need of a good idea. django drives me crazy with its > foreignkey-resolver. > > class

Re: Specific fields in 'select'

2009-08-22 Thread Tim Chase
> How do I tell Django which fields to select from my database? It seems > to always use SELECT * FROM, which isn't ideal since I don't need all > the extra data for my project listing page, just the 'title' and > 'slug' field. read up on the .values() method. -tkc

Specific fields in 'select'

2009-08-22 Thread Hanpan
I know this is probably really simple, but I have lost hours trying to figure it out. How do I tell Django which fields to select from my database? It seems to always use SELECT * FROM, which isn't ideal since I don't need all the extra data for my project listing page, just the 'title' and

Re: Dynamically add a line to an inlineformset

2009-08-22 Thread Andew Gee
I believe it wa the last of your suggestions, I was wrinting out the fields of the main form individually and somehow they must of been overwriting the inlineforms fields. I removed the loop that was doing the main form and just used the form object and it worked. So i need to go back and look

Re: How to validate image dimensions?

2009-08-22 Thread Léon Dignòn
Thank you! I will youse TiNo's solutions. The resize feature is huge! On Aug 21, 6:10 pm, Alex Gaynor wrote: > On Fri, Aug 21, 2009 at 3:50 AM, TiNo wrote: > > On Fri, Aug 21, 2009 at 10:40, Léon Dignòn wrote: > > >> Hello, > > >>

Re: Using models inside settings.py

2009-08-22 Thread Alessandro
2009/8/22 Jan Hülsbergen : > > The root directory of your Django project should be in sys.path > anyway, so a simple 'import local_cms_settings' should just work. Even > if not, putting the directory into sys.path is much less evil/hacky > than using exec/eval. my project is on

Re: Dynamically add a line to an inlineformset

2009-08-22 Thread Matthias Kestenholz
On Sat, Aug 22, 2009 at 7:53 AM, Andew Gee wrote: > > Thank you for your help. > > I have managed to get the inlineforms to reproduce on my page, however > when I submit the form the extra inlines are ignored. I have printed > the formset when it hits the view and the new

Re: Dynamically add a line to an inlineformset

2009-08-22 Thread Andew Gee
Thank you for your help. I have managed to get the inlineforms to reproduce on my page, however when I submit the form the extra inlines are ignored. I have printed the formset when it hits the view and the new lines that I have added have no values in them, the values that I enter in are not