Re: Paginator Overhall

2006-10-16 Thread SmileyChris
On Oct 17, 6:11 pm, "SmileyChris" wrote: > - #2575 fixes up some of the messy bits (including a few bugs) and adds > orphaning. Oh, and it also makes Paginator work with lists/tuples. --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: Paginator Overhall

2006-10-16 Thread SmileyChris
Just chiming in, To clarify, I only have two patches regarding pagination: - #2575 fixes up some of the messy bits (including a few bugs) and adds orphaning. - #2576 makes a PaginatorPage object which is useful for self-contained pages (IMO usual use on a template) > Trying to account for everyb

7 Habits of Highly effective Person By Stephen Covey: Audio Books

2006-10-16 Thread P K Kothari
Links given for first two parts of audio Books in Audio Book section. Balance parts will be shortly given-- With warm regardsP K KothariDownload PowerPoint Presentation files:   http://powerpoint-presentation.blogspot.comDownload eBooks:  http://ebook-share.blogspot. Download Audio books in MP3:  h

Re: psycopg trouble

2006-10-16 Thread Jeremy Dunck
On 10/16/06, juampa <[EMAIL PROTECTED]> wrote: > So, I run: > > ./configure --with-postgres-includes=/usr/local/pgsql/include > --with-postgres-lib=/usr/local/pgsql/lib > --with-mxdatetime-includes=/Library/Frameworks/Python.framework/Versions/2.5/lib/Python2.5/site-packages/mx/DateTime/mxDateTim

Re: DB caching - how does Django handle external changes to the DB

2006-10-16 Thread Kenneth Gonsalves
On 16-Oct-06, at 8:49 PM, Stefán Freyr Stefánsson wrote: > sort of a caching mechanisme that is hard to "turn off", making it > vulnerable to not picking up changes to the data that is done by > external processes. it picks up changes made to the data in database - dont think you need to

psycopg trouble

2006-10-16 Thread juampa
Hello out there: This issue seems to be a recurruing one, but I have been unable to find a post that solves it. I can't compile psycopg 1.1.21 on my core 2 Duo iMac. For that matter, I can't compile it on a G4 iMac or a G3 iBook. Somehow I managed to compile it in a G4 in the past, but I can't

Re: Model Reuse

2006-10-16 Thread Steve Wedig
Alrighty, I've pulled out the relationships into separate separate models, as shown below. This correctly represents the information. However, I would like to work with the sets of related threads directly, rather than always traversing the intermediate models. I'm not sure how to write the funct

Re: Modular apps question

2006-10-16 Thread Malcolm Tredinnick
On Mon, 2006-10-16 at 13:37 -0700, Rob Hudson wrote: > I have a central app that is going to be in all projects. I have a few > ancillary apps that may or may not be part of my project. What I'd > like to do in my main view code is to see if the app is loaded before I > invoke a call in that anc

Re: DateTime field validation

2006-10-16 Thread Malcolm Tredinnick
On Mon, 2006-10-16 at 12:20 -0700, plisk wrote: > Hi there, > > Is it possible somehow to validate DateTime field in admin against > another DateTime field(with validators.IsLessThanOtherField for > example) without writing custom validator ? With > validators.IsLessThanOtherField it complain

Re: doctests and type(_) is bool ?

2006-10-16 Thread Malcolm Tredinnick
On Mon, 2006-10-16 at 21:00 +0200, [EMAIL PROTECTED] wrote: > Hi Malcolm, > > > > > Needs more investigation to confirm if this is the case. Ine test would > > be to explicitly import gettext() as _() in your test file, since that > > would introduce different aliasing rules for the two cases, I

Re: Re: Django, Postgres and Server Crash

2006-10-16 Thread Malcolm Tredinnick
On Mon, 2006-10-16 at 13:45 -0500, James Bennett wrote: > On 10/16/06, Mike <[EMAIL PROTECTED]> wrote: > > The server is rather new. 2GB of memory with a top grade Opteron (not > > sure which). Once again, the server is running with low load for most > > of the day, and as much as I want to, I hav

Re: adding images to my content

2006-10-16 Thread RajeshD
> > > The admin does not show the full path of the uploaded file, so the end > > > user would need to fiddle with the path ... trying to smoothen this > > > process so the url that is displayed in admin is the full path or at > > > least a path that works. Or god forbid drag and drop! ;) > > As

Re: print_r

2006-10-16 Thread Terry
Don Arbow wrote: > The method is actually called pdb.set_trace(). Whoops! So it is. Sorry for the confusion. - Terry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: adding images to my content

2006-10-16 Thread Milan Andric
On Oct 16, 2:46 pm, "RajeshD" <[EMAIL PROTECTED]> wrote: > > The admin does not show the full path of the uploaded file, so the end > > user would need to fiddle with the path ... trying to smoothen this > > process so the url that is displayed in admin is the full path or at > > least a path tha

Re: print_r

2006-10-16 Thread Don Arbow
On Oct 16, 2006, at 1:30 PM, Rob Hudson wrote: > > On Oct 16, 1:00 pm, "Terry" <[EMAIL PROTECTED]> wrote: >> Easiest way I've found to do it is to add the following as the first >> two lines of the view function that you want to debug: >> >> import pdb >> pdb.run_trace() >> >> Then, when y

Re: DB caching - how does Django handle external changes to the DB

2006-10-16 Thread Stefán Freyr Stefánsson
Thanks a lot for your replies Corey and Rajdesh.I'll go this way then :-) ... as soon as I figure out how it's best for me to implement async calls to MySQL from a C/C++ application.Thanks again for the replies and thanks to the creators/maintainers/testers and everybody that make Django a reality.

Re: custom-query or redundant-data, which is worse? :)

2006-10-16 Thread Terry
gabor wrote: > which way do you chose-usually/recommend? I would go with the custom query. This is the DRY principle (see http://www.djangoproject.com/documentation/design_philosophies/#don-t-repeat-yourself-dry ): don't write down any data more than once. The exception is when you actually se

Re: adding images to my content

2006-10-16 Thread RajeshD
> > The admin does not show the full path of the uploaded file, so the end > user would need to fiddle with the path ... trying to smoothen this > process so the url that is displayed in admin is the full path or at > least a path that works. Or god forbid drag and drop! ;) > As a quick fix, in

Re: custom-query or redundant-data, which is worse? :)

2006-10-16 Thread Joseph Heck
I would lean towards a custom-query model - but that's my own inclination from having had to clean up dirty data far too often. The QuerySets get you the basics nicely - but sometimes you just need to cobble out some custom SQL - and Django enables that nicely too. -joeOn 10/16/06, gabor <[EMAIL PR

custom-query or redundant-data, which is worse? :)

2006-10-16 Thread gabor
hi, i'd like to know your opinion about a decision i have to make a lot of times while developing with django... an example: let's have a system where sometimes we have to send out a LOT of emails. so we decide to have a periodically running process (cronjob, probably), that will check whethe

adding images to my content

2006-10-16 Thread Milan Andric
Hello, I can serve my static files no problem, in apache I did SetHandler None and an Alias /media /homedir/djangostuff/myapp/media. The trick comes in the process or flow of adding files/images into a body of text. I'm adding content to the db through the admin and using markdown in the conte

Re: DB caching - how does Django handle external changes to the DB

2006-10-16 Thread Corey Oordt
Stefan, In my apps I do TONS of offline processing, but an able to have users tweak things using the Admin interface. I haven't had any issues with caching or outdated data. Good luck! Corey Oordt On Oct 16, 2006, at 11:19 AM, Stefán Freyr Stefánsson wrote: > Hello. > > I have a deadline o

Re: How the @$$#% can I debug FastCGI errors ?

2006-10-16 Thread orestis
Nope, unfortunately this doesn't help with fastcgi internal errors. Even if debug = True or debug = False, if there is an internal fastcgi error, you won't get either the django error page, or the flup error page. Instead you get a standard 500 server error (in Firefox at least) which I can replac

Re: Need an advice: simple Online Store project (long)

2006-10-16 Thread Serg Kovrov
No, I wasn't. Thanks for pointing out. Although I didn't found (yet) anything regarding attributes inheritance, project itself looks interesting. And it have it's own news group! Perhaps worth to checkout code... On Oct 16, 11:35 pm, Steven Armstrong <[EMAIL PROTECTED]> wrote: > Are you aware of

Re: print_r

2006-10-16 Thread Terry
Rob Hudson wrote: > I was trying to see what this did but I get an error that there is no > run_trace() method in pdb. In looking at pdb from the Python shell, I > see this is true. At least for my Python version (2.3.5). Did you > mean another method? If so, could you explain more? No, that

Re: print_r

2006-10-16 Thread Steven Armstrong
On 10/16/06 21:11, Rob Hudson wrote: > On Oct 16, 11:17 am, Steven Armstrong <[EMAIL PROTECTED]> wrote: >> A djangofied version of this [1] would be cool. >> >> [1]http://pythonpaste.org/screencasts/evalerror-screencast.html > > I agree. That would be very useful. One could argue that it should

Modular apps question

2006-10-16 Thread Rob Hudson
I have a central app that is going to be in all projects. I have a few ancillary apps that may or may not be part of my project. What I'd like to do in my main view code is to see if the app is loaded before I invoke a call in that ancillary app. Would the best bet be to pull in settings.INSTAL

Re: Need an advice: simple Online Store project (long)

2006-10-16 Thread Steven Armstrong
On 10/16/06 22:24, Serg Kovrov wrote: > Hello. I'd like to try to build a simple (I believe) project with > Django - an Online Store. That is, browseble and manageable catalog of > arbitrary goods. > > > Here is the draft data models for my project. > > * Item. Representation of actual goods. B

Re: print_r

2006-10-16 Thread Rob Hudson
On Oct 16, 1:00 pm, "Terry" <[EMAIL PROTECTED]> wrote: > Easiest way I've found to do it is to add the following as the first > two lines of the view function that you want to debug: > > import pdb > pdb.run_trace() > > Then, when you attempt to load the view, you will get the (pdb) prompt

Need an advice: simple Online Store project (long)

2006-10-16 Thread Serg Kovrov
Hello. I'd like to try to build a simple (I believe) project with Django - an Online Store. That is, browseble and manageable catalog of arbitrary goods. Here is the draft data models for my project. * Item. Representation of actual goods. Belong to one of the Categories. Category defines att

Re: Returning an average from a Related Field.

2006-10-16 Thread MerMer
John, Excellent. The requirement to make it easily sortable makes your solution compelling. Thanks for detailing. Plus Im sure that there will lots of places where this type of Signals method would be handy. MerMer --~--~-~--~~~---~--~~ You received this messag

Re: Returning an average from a Related Field.

2006-10-16 Thread johnnnnnnn
On Sun, Oct 15, 2006 at 01:26:18PM -0700, MerMer wrote: > I have two Models. > > 1. Product > 2. Review - There can be many reviews for any product (one -to many > relationship) > > One of the fields of Review is "Rating". This holds an integer between > 1 and 5. > > I want to display a lis

Re: print_r

2006-10-16 Thread Terry
code enquest wrote: > in PhP i used to print_r(array) to see what if got in my array that I > want to bring on the screen. Smarty even had a popup screen to show this. > > How can I see in Django what I got in the view? So that working in the > template goes a tat faster? What is the print_r($arra

Re: Returning an average from a Related Field.

2006-10-16 Thread Tim Chase
> Any suggestions on how would you get the server to calculate > and return the average? Though I believe someone else already answered this, Django allows you to fire off live SQL queries, which can do things like SELECT AVERAGE(column_name1) FROM tblTable which will just return the average o

Re: Returning an average from a Related Field.

2006-10-16 Thread MerMer
Tim, Many thanks - that has helped me understand alittle more about Python. I'm sure that there is a faster way. It's been more of an exercise for me to try and get to understand Django, Python etc. I'm practically a complete newbie. Any suggestions on how would you get the server to calculate

DateTime field validation

2006-10-16 Thread plisk
Hi there, Is it possible somehow to validate DateTime field in admin against another DateTime field(with validators.IsLessThanOtherField for example) without writing custom validator ? With validators.IsLessThanOtherField it complains because of in all_data DateTime field is splitted to Date

Re: print_r

2006-10-16 Thread Rob Hudson
On Oct 16, 11:17 am, Steven Armstrong <[EMAIL PROTECTED]> wrote: > A djangofied version of this [1] would be cool. > > [1]http://pythonpaste.org/screencasts/evalerror-screencast.html I agree. That would be very useful. One could argue that it should only be accessible when running under WSGI.

Re: How the @$$#% can I debug FastCGI errors ?

2006-10-16 Thread James Bennett
On 10/16/06, orestis <[EMAIL PROTECTED]> wrote: > PLEASE PLEASE someone if you know how to deal with this stuff drop a > line here. Set DEBUG=True and look at the error page? -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~--

Re: doctests and type(_) is bool ?

2006-10-16 Thread dummy
Hi Malcolm, > > Needs more investigation to confirm if this is the case. Ine test would > be to explicitly import gettext() as _() in your test file, since that > would introduce different aliasing rules for the two cases, I believe. > from django.utils.translation import gettext as _ worked fin

How the @$$#% can I debug FastCGI errors ?

2006-10-16 Thread orestis
This is driving me CRAZY! The FastCGI logs show nothing (the stupid incomplete headers message). However, I get my custom FastCGI error page. (internal_error.html). My site is on and off every 5 minutes, I can't stand it. I've contacted the host (dreamhost) but I've yet to get an answer. PLEASE

Re: Re: Django, Postgres and Server Crash

2006-10-16 Thread James Bennett
On 10/16/06, Mike <[EMAIL PROTECTED]> wrote: > The server is rather new. 2GB of memory with a top grade Opteron (not > sure which). Once again, the server is running with low load for most > of the day, and as much as I want to, I have hard time believing its > the server that is to blame. FWIW,

Re: Re: Django, Postgres and Server Crash

2006-10-16 Thread James Bennett
On 10/16/06, Mike <[EMAIL PROTECTED]> wrote: > I just svn update my django directory. Doesn't the latest django > version reflect all the bug fixes? Do I have to check out > 0.91-bugfixes? The "bugfixes" branches are only for the older (0.90 and 0.91) versions of Django, and I only mentioned them

Re: mod_python help needed

2006-10-16 Thread moberley
doug wrote: > the flatpages url must be LAST in the list of urls to try- not sure > why- but that fixed it. The flatpages pattern must be at the end of the patterns because an include pattern forwards the entire portion of the url request following the matched part. The flatpages pattern is an em

Re: print_r

2006-10-16 Thread Steven Armstrong
On 10/16/06 17:43, Rob Hudson wrote: > [EMAIL PROTECTED] wrote: >> I quite often plug in a nonsense command e.g. "fudge" just to raise the >> debug page, maybe with a few > > I do the same. It would be awesome if there were a "debugger" app > (contrib app anyone?) that we could load in the templ

Re: Returning an average from a Related Field.

2006-10-16 Thread Tim Chase
>def av_rating(self): > queryset = self.review_set.all() > x=0 > y=0 > for rating in queryset: > x=x+rating.rating > y=y+1 > return x/y > > {{ objects.av_rating }} is the tag that is then put in the te

Re: Returning an average from a Related Field.

2006-10-16 Thread MerMer
Looking at the options, I've also experimented with creating a custom Model method. The following almost works ( The division at the end returns an error and I'm new at Python so need to work that out) def av_rating(self): queryset = self.review_set.all() x=0

Re: Django, Postgres and Server Crash

2006-10-16 Thread Gary Doades
On Monday 16 October 2006 18:01, Mike wrote: > The server is rather new. 2GB of memory with a top grade Opteron (not > sure which). Once again, the server is running with low load for most > of the day, and as much as I want to, I have hard time believing its > the server that is to blame. But it

Re: Django, Postgres and Server Crash

2006-10-16 Thread Tim Chase
> Pressing 'c' on top clears everything a little bit. One thing > I think I forgot to mention is 90% of the time the server load > is moderate. It is 3 times a week around early in the morning > that my django and postgres start dancing to death for me. > Given that my server hardware handles the

Re: Choosing a format for built-in comments

2006-10-16 Thread Waylan Limberg
On 10/14/06, Tool69 <[EMAIL PROTECTED]> wrote: > > Hi Waylan, > Thanks for pointing me this site, I've learned a lot. > The problem is that I'm using the built-in freecomment, so if I need to > add a field I'm obliged to change the original Django code in > \django\contrib\comments. Is there any p

Re: Django, Postgres and Server Crash

2006-10-16 Thread Mike
> What are the specs of the server? Specifically, how much RAM does it > have and how fast are its disks? What processors are in the machine > (for postgres, Xeons are bad, Opterons are very, very good)? The server is rather new. 2GB of memory with a top grade Opteron (not sure which). Once agai

Re: Django, Postgres and Server Crash

2006-10-16 Thread Mike
James, Thanks for your response. I just svn update my django directory. Doesn't the latest django version reflect all the bug fixes? Do I have to check out 0.91-bugfixes? Pressing 'c' on top clears everything a little bit. One thing I think I forgot to mention is 90% of the time the server load

Re: SyncDB INT -> BIGINT

2006-10-16 Thread MindsX
So I'll convert: backends/ado_mssql/creation.py: 'AutoField': 'int IDENTITY (1, 1)', 'PositiveIntegerField': 'int CONSTRAINT [CK_int_pos_%(column)s] CHECK ([%(column)s] > 0)', to: 'AutoField': 'bigint IDENTITY (1, 1)', 'PositiveIntegerField': 'bigint CONSTRAINT [CK_int_pos_%(col

Re: Re: Django, Postgres and Server Crash

2006-10-16 Thread James Bennett
On 10/16/06, Siah <[EMAIL PROTECTED]> wrote: > I tried increasing the number of postgres connections, and it ended up > completely killing the server. The server I'm working with has 2 django > sites running, one of which receives around 3M hits a month. The other > one somewhere around 200K hits,

Re: Django, Postgres and Server Crash

2006-10-16 Thread Siah
Per connection? Does it mean per request, or page view? I tried increasing the number of postgres connections, and it ended up completely killing the server. The server I'm working with has 2 django sites running, one of which receives around 3M hits a month. The other one somewhere around 200K h

Re: Django, Postgres and Server Crash

2006-10-16 Thread James Bennett
On 10/16/06, Siah <[EMAIL PROTECTED]> wrote: > How many postmaster instances should be running at once? Also, if you're running an older version of Django, be sure to update to the "bugfixes" branch for it; the mod_python handler had a bug in it which could leak DB connections, and which has sinc

Re: Django, Postgres and Server Crash

2006-10-16 Thread James Bennett
On 10/16/06, Siah <[EMAIL PROTECTED]> wrote: > How many postmaster instances should be running at once? Are you talking about 'postmaster', or 'postgres'? The default behavior of top has a nasty habit of confusing the two; press 'c' to have it show the full info. That said, we have a bunch of po

Re: django embedded web server

2006-10-16 Thread Rob Hudson
I'm also of the opinion that Django can only benefit by making the built-in development web server better. If I can develop Django projects without the need to install Apache (or other web server) and use SQLite, that's awesome. For static files I can just use something like this: (r'^(

Re: aggregator

2006-10-16 Thread [EMAIL PROTECTED]
> 1. the "from" needs to define from where you want to grab the models. > Somehow it always fails to do this. So I'm doing something wrong. Maybe > somebody can tell me how to do it. Have you checked your pythonpath to make sure that the djangoproject.com directory is available? Otherwise, it wi

Re: mod_python help needed

2006-10-16 Thread doug
mystery solved -kinda- the flatpages url must be LAST in the list of urls to try- not sure why- but that fixed it. Doug thanks- Doug On Oct 15, 12:15 am, "moberley" <[EMAIL PROTECTED]> wrote: > doug wrote: > > I am setting up mod_python on test server and having some problems. I > > am getti

Re: main menus

2006-10-16 Thread [EMAIL PROTECTED]
What seems to be giving you trouble? It's hard to provide help if there's not a clear question that's being asked. It sounds like you have a plan to create a Menu model with 7 associated TextFields. That's maybe not necessarily how I'd go about it, but it sounds like you're on your way to gettin

Re: Migrating from Posgresql to MySql

2006-10-16 Thread [EMAIL PROTECTED]
My overall experince with PostgreSQL is that as long as the database has a good design with all the proper datatypes, indexes etc. then it will perform as good as, if not better than many database servers out there (MySql included). Do you have a sepcific query that is the problem? The guys on th

Re: Django, Postgres and Server Crash

2006-10-16 Thread [EMAIL PROTECTED]
Postgres uses one process per connection. How many simultaneous connections have you got in total? If you don't have that many simultaneous users then you may not be closing database connections somewhere. You can increase the number of connections that Postgres can handle, but it looks like you

Re: DB caching - how does Django handle external changes to the DB

2006-10-16 Thread RajeshD
> > My question is whether Django is a good choice for me. What I'm mostly > worried about is if Django has some sort of a caching mechanisme that is > hard to "turn off", making it vulnerable to not picking up changes to the > data that is done by external processes. Django does not have anythin

Re: [django-users] suggestion

2006-10-16 Thread Marcus Mendes
Thanks so much Sirs. I did a filter at my gmail. Thanks again. Marcus On 10/15/06, Don Arbow <[EMAIL PROTECTED]> wrote: > > On Oct 15, 2006, at 3:18 PM, Marcus Mendes wrote: > > > > Hello all, > > what about if we put "[django-users]" (or something like this) string > > at the begining of subjec

Re: print_r

2006-10-16 Thread Rob Hudson
[EMAIL PROTECTED] wrote: > I quite often plug in a nonsense command e.g. "fudge" just to raise the > debug page, maybe with a few I do the same. It would be awesome if there were a "debugger" app (contrib app anyone?) that we could load in the template: {{ debugger }} That would show a unobtru

DB caching - how does Django handle external changes to the DB

2006-10-16 Thread Stefán Freyr Stefánsson
Hello.I have a deadline on a project coming up so I'm hoping that you will forgive me for posting a question that I could technically experiment with myself but because of the deadline I would very much like to receive input from the django community on whether my time is well spent on doing this o

Django, Postgres and Server Crash

2006-10-16 Thread Siah
Hello, I am running django on heavy load server, and multiple times a week I have my postgres crashing due to high server load. When I get TOP, I see many many postmasters running at the same time, until I get 'Too many connections' postgres failiour error from postmaster emailed to me from djang

Re: template error

2006-10-16 Thread doug
oh-yea! sudo chmod -R 755 /path-to-templates Thanks- Doug On Oct 16, 10:14 am, Michael Radziej <[EMAIL PROTECTED]> wrote: > doug schrieb: > > > > > Hey- > > > Why am I getting this error if the template file exists? > > > # > > Template-loader postmortem > > > Django tried loa

aggregator

2006-10-16 Thread Enquest
I'm using this script from the django website via the wiki. http://code.djangoproject.com/browser/djangoproject.com/django_website/apps/aggregator/bin/update_feeds.py I'm having trouble with executing it!... 1. the "from" needs to define from where you want to grab the models. Somehow it always

main menus

2006-10-16 Thread Mary Adel
Dear all ; I am developing a normal website that has a main menues and i need this main menus to be editable i ll develop the pages as flatfiles and i need create another model that will have 7 text boxes containing the text of the main menus and then i can import the 7 text fields in the htm

Re: print_r

2006-10-16 Thread Dirk Eschler
Am Sonntag, 15. Oktober 2006 00:01 schrieb [EMAIL PROTECTED]: > I quite often plug in a nonsense command e.g. "fudge" just to raise the > debug page, maybe with a few > > x = dir(some_var) > > .. to see what's in them. Once the Django debug page is up, you can > have a really good poke around with

Setting SITE_ID dynamically

2006-10-16 Thread Afternoon
I would like to create a virtual hosting style solution which allows: * New sites to be created through-the-web. * Multiple domains to be assigned to each site. * Each site to have separate media and templates folders. The requirements are not too difficult, I can implement most of this on to

Re: template error

2006-10-16 Thread Michael Radziej
doug schrieb: > Hey- > > > Why am I getting this error if the template file exists? > > # > Template-loader postmortem > > Django tried loading these templates, in this order: > > * Using loader > django.template.loaders.filesystem.load_template_source: > o /home

template error

2006-10-16 Thread doug
Hey- Why am I getting this error if the template file exists? # Template-loader postmortem Django tried loading these templates, in this order: * Using loader django.template.loaders.filesystem.load_template_source: o /home/doug/templates/blog/entry_archive.html

Re: admin interface for legacy database

2006-10-16 Thread Ewout ter Haar
On 10/15/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > The value of Users.icon either has to be a valid primary key value in > the table for the Icon model or NULL (of you have null=True in the > ForeignKey constructor). This is because a Django ForeignKey field is a > true foreign key in t

Re: Returning an average from a Related Field.

2006-10-16 Thread Jonathan Buchanan
On 10/16/06, MerMer <[EMAIL PROTECTED]> wrote: > > Jonathan, > > I don't want to the list to be filtered to only those who have a > Rating. I need to display ALL the products, while still showing the > average rating for those products which have a rating. > > Example Table: > > -- Pr

Re: Returning an average from a Related Field.

2006-10-16 Thread MerMer
Jonathan, I don't want to the list to be filtered to only those who have a Rating. I need to display ALL the products, while still showing the average rating for those products which have a rating. Example Table: -- Price --- # Reviews ---Average Rating Product 1 $24

Re: Returning an average from a Related Field.

2006-10-16 Thread Jonathan Buchanan
> Jonathan, > > Many thanks for this. > > Sorry to be a pain , but I have a couple of follow on questions, so I'm > clear. > > 1. How should I best implement this code. As a custom tag or in the > view? > > 2. Any suggestions on how I should pass the product.id to the code? > > Thanks > > MerMer

Re: Model Reuse

2006-10-16 Thread Malcolm Tredinnick
On Mon, 2006-10-16 at 02:44 -0700, Steve Wedig wrote: > I have a thread model that I would like to reuse in multiple places. > So a thread should have no knowledge of where it is contained. > > I also have a group model and a location model. I would like to have > multple threads in a group (1-n

Re: Migrating from Posgresql to MySql

2006-10-16 Thread Rory Campbell-Lange
Hi Giovanni Postgresql has a very useful COPY command which should be able to do what you need. See http://www.postgresql.org/docs/8.1/static/sql-copy.html You will see that you can export to files in various custom formats, while CSV mode is supported specially. You may need to issue the

Re: Returning an average from a Related Field.

2006-10-16 Thread MerMer
Jonathan, Many thanks for this. Sorry to be a pain , but I have a couple of follow on questions, so I'm clear. 1. How should I best implement this code. As a custom tag or in the view? 2. Any suggestions on how I should pass the product.id to the code? Thanks MerMer --~--~-~--~---

Re: Displaying number of visitors

2006-10-16 Thread orestis
OK, I did it. Unfortunately, the session table is using pickled data, so the processing has to be done in django. Here it goes: In views that you would like to refresh the active state of a user, add: request.session['last_seen']= datetime.datetime.now() Then, in a util.py : from django.contri

Re: Returning an average from a Related Field.

2006-10-16 Thread Jonathan Buchanan
On 10/15/06, MerMer <[EMAIL PROTECTED]> wrote: > > I have two Models. > > 1. Product > 2. Review - There can be many reviews for any product (one -to many > relationship) > > One of the fields of Review is "Rating". This holds an integer between > 1 and 5. > > I want to display a list of Produ

Re: ImageField

2006-10-16 Thread Guillermo Fernandez Castellanos
I had a similar problem. I havent found any definitive solution, but there is some solutions that might help: Create a new model: class Image(models): image = models.ImageField(...) Add to your post model: images = models.ForeignKey(Image) Then, create a special view to create posts, wh

Model Reuse

2006-10-16 Thread Steve Wedig
I have a thread model that I would like to reuse in multiple places. So a thread should have no knowledge of where it is contained. I also have a group model and a location model. I would like to have multple threads in a group (1-n reln between group and thread). I would also like threads to app

Migrating from Posgresql to MySql

2006-10-16 Thread Giovanni Giorgi
Hi all, I have loved django for its readiness with PostgreSQL. I have done the set up of my blog on openhosting.com. But when I tried to set up more complex applications, I noted postgresql is very slow on my virtual linux machine. I have tried to tune it in a bunch of ways without so much succes

ImageField

2006-10-16 Thread Ramdas S
Hi,   In a classic blog/content driven web app, if you need to add more than 2 images in an article body, what you should do?   I know I can manage by  creating multiple ImageFields in my model, to accomodate more pictures. but is there any other solutions?   Suppose I need to publish  some stuff t

limit_choices_to according the field of the current model?

2006-10-16 Thread Aidas Bendoraitis
Hello Djangoers! I have many Vocabularies and nested Categories in each of the Vocabularies, described in the following way: from django.db import models class Vocabulary(models.Model): name = models.CharField(maxlength=20) class Category(models.Model): vocabulary = models.Foreign