Re: How to use lighttpd error-handler-404 handler to serve django?

2006-07-17 Thread wlt008
thank u. In lighttpd, it is difficult to use conditional statments combined with url rewrite. So my solution is do a hack on django. Just use a monkey patch on xxx.fcgi(the fast cgi handler) in order to make error-handler-404 work: Below is my django.fcgi: --- django.fcgi

Re: Web Developer Training

2006-07-17 Thread Kenneth Gonsalves
On 17-Jul-06, at 8:03 AM, Leon wrote: > i meant non-programmers as in people who are programming literate, but > don't consider themselves the programmer or spend their life in code that would be an edge case, but unless they are willing to spend some of their life in code, django will not be

ifequal template problem

2006-07-17 Thread Carlos Yoder
Hello there, I'm using a object_detail generic view to display some data. One of the object's fields is an IntegerField, with choices limited to MONTHS, a tuple of tuples mapping the values. Now, on the template I want to expand the stored values to the 'human_readable' val, using somehting like

Re: ifequal template problem

2006-07-17 Thread Carlos Yoder
Forgot to say, I have the same logic working with no problem, but for a CharField, so this issue must be related to the field's datatype... On 7/17/06, Carlos Yoder <[EMAIL PROTECTED]> wrote: > Hello there, > > I'm using a object_detail generic view to display some data. One of > the object's fie

Velicity Von Titfuck

2006-07-17 Thread carlito556
Velicity Von Titfuck at http://www.rosapink.net Tell your friends it's free !! --~--~-~--~~~---~--~~ 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.c

ImportError: No module named django

2006-07-17 Thread markguy
I have poked around looking for an answer to this and none of the suggestions/fixes I found did the trick. Ubuntu 6.06/Python 2.4.3/Apache2.0.55/mod_python3.1.4/mySQL5.0.22/Django0.95 Relevant bits to follow httpd.conf: SetHandler mod_python PythonHandler django.core.hand

Everyone should read the tests directory (was Re: Loose coupling of objects.)

2006-07-17 Thread Paul
[EMAIL PROTECTED] wrote: > The core version was built using Luke Plant's work and Ian Holsman's > work, kind of the best of both worlds. Yeah, once I started looking at the code I saw the commit logs that said the same thing. Good to see things growing that quickly. It's nice to think I was hav

Re: Filter on count of ManyToManyField

2006-07-17 Thread Carlos Yoder
I had a similar problem, and just used custom SQL. It's easy: from django.db import connection cursor = connection.cursor() cursor.execute(""" SELECT cars_model.id, cars_model.opis, cars_znamka.id, cars_znamka.opis, COUNT(*)

Re: Everyone should read the tests directory (was Re: Loose coupling of objects.)

2006-07-17 Thread Malcolm Tredinnick
On Mon, 2006-07-17 at 10:57 +, Paul wrote: > > [EMAIL PROTECTED] wrote: > > The core version was built using Luke Plant's work and Ian Holsman's > > work, kind of the best of both worlds. > > Yeah, once I started looking at the code I saw the commit logs that > said the same thing. Good to s

Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick
On Mon, 2006-07-17 at 03:57 -0700, markguy wrote: > I have poked around looking for an answer to this and none of the > suggestions/fixes I found did the trick. > > Ubuntu 6.06/Python > 2.4.3/Apache2.0.55/mod_python3.1.4/mySQL5.0.22/Django0.95 > > Relevant bits to follow > httpd.conf: > >

Registration Form - Manipulators

2006-07-17 Thread spako
Hi i'm using django's built in User for web registered users, to add extra fields to these users i've created a UserProfile model and linked it to User using a OneToOneField. Now when someone goes to the site to register I want them to see a form with fields from User and some from UserProfile.

Not sure how to do this (many to many problem)

2006-07-17 Thread Carlos Yoder
Hello! I'm building a sort of b2b app that lists a car catalogue. A car can have multiple 'special prices', linked to groups of wholesalers. So when wholesaler W logs into the app, he should see a 'special price just for you' control, displaying the proper price. In a custom app I'd have a 'mod

Re: user registration

2006-07-17 Thread Aidas Bendoraitis
A few weeks ago I browsed through Django core code to get a basic understanding how to create a user registration or any other form using generic manipulators and how to fill in some values (such as last_login) behind the scene. I was following the guidelines about manipulators at: http://www.dja

Re: ImportError: No module named django

2006-07-17 Thread markguy
I'm covering all the bases. Or trying to. re: django_source: Wow. Uh, thanks. I have no idea why I typed that out fully in httpd.conf. Fixing that leads to a new error: EnvironmentError: Could not import settings 'bbg.settings' (Is it on sys.path? Does it have syntax errors?): No module named bb

Re: Not sure how to do this (many to many problem)

2006-07-17 Thread Carlos Yoder
I guess I found a lead at tests\modeltests\m2m_intermediary\ if anyone knows if that's correct (or wrong as hell), please let me know :-) On 7/17/06, Carlos Yoder <[EMAIL PROTECTED]> wrote: > Hello! > > I'm building a sort of b2b app that lists a car catalogue. A car can > have multiple 'speci

Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick
On Mon, 2006-07-17 at 04:43 -0700, markguy wrote: > I'm covering all the bases. Or trying to. > > re: django_source: Wow. Uh, thanks. I have no idea why I typed that out > fully in httpd.conf. Fixing that leads to a new error: > > EnvironmentError: Could not import settings 'bbg.settings' (Is it

Re: Registration Form - Manipulators

2006-07-17 Thread Aidas Bendoraitis
What I do to create a view that includes both -- the User and the UserProfile -- is following the documentation of forms and manipulators http://www.djangoproject.com/documentation/forms/ and writing something like this: def add_profile(request): from datetime import datetime user_manipul

Re: Not sure how to do this (many to many problem)

2006-07-17 Thread Javier Rivera
Carlos Yoder escribió: > The problem is, I don't know how to do this in Django. I tried doing: Well, I'm new to django, but I don't believe that the ManytoMany field could be used this way. It can for sure relate both tables (user and car), but I don't know how to add a third value. I'd do it

Re: user registration

2006-07-17 Thread patrickk
here´s the registration I´ve come up with. I´m using a Custom Manipulator, because I´ve added some fields to the User Model and need specific validation. I´ve also added a confirmation mail: def registration(request): manipulator = RegistrationManipulator() if request.POST:

Re: Not sure how to do this (many to many problem)

2006-07-17 Thread Carlos Yoder
> I'd do it the "classic" way. Thank you Javier, that did it. Little thing remains though. My admin console for a Car is quite large, and it's organized neatly using Admin.fields. However, the SpecialPrices table (linked here using edit_inline=True), always appear at the end of the page. Do you

Re: Django and Threading

2006-07-17 Thread Jeremy Dunck
On 7/15/06, David Blewett <[EMAIL PROTECTED]> wrote: > I'm starting to work on a webmail app in Django. I came across an > improved version of > imaplib1 that uses threads for some of the calls to the IMAP server. > Will this cause > problems in a Django / mod-python / Apache scenario? Or should I

Re: Not sure how to do this (many to many problem)

2006-07-17 Thread Javier Rivera
Carlos Yoder escribió: > Do you know of a way to configure and alter this behaviour? No. But it could probably be achieved playing with the admin CSS. Javier. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: ImportError: No module named django

2006-07-17 Thread markguy
Malcolm Tredinnick wrote: > That should be easy enough to diagnose. My initial guess would be that > bbg is in django_projects/, rather than django_src/, just from the way > you named your directories. Remember that .bash_profile is obviously not > going to be run by Apache (it's not bash, after

Re: user registration

2006-07-17 Thread Aidas Bendoraitis
It seems that you are missing the escaping/converting of the got(ten) values. Don't you need something like manipulator.do_html2python(new_data) before saving the user? I think there is a risk of SQL injection[1] in your example. [1] http://en.wikipedia.org/wiki/Sql_injection Aidas Bendoraiti

display_name for FormFields

2006-07-17 Thread Todd O'Bryan
Would anyone object to a patch for FormFields that would allow a (by- default None) keyword argument for display_name. Validator error messages would be updated to use the display_name if it's defined, or the field_name, if not. I think this would be completely backward-compatible, but would

Re: ImportError: No module named django

2006-07-17 Thread markguy
So, what you were *really* suggesting was that PYTHONPATH should include the project directory, not the django_src directory? I saw that while skimming through the docs. I changed PYTHONPATH to reflect that (apparently, adding both directories in a fit of crankiness doesn't help matters): Python

Re: Multiple block levels failing?

2006-07-17 Thread Adrian Holovaty
On 7/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > The thing is, when I take the level2 block out of the ifequal loop, > everything works fine. So, it looks to me that it can have only so many > if's around a block statement or something... Is this a bug or am I > doing something wrong? I

Re: ImportError: No module named django

2006-07-17 Thread markguy
Changing bbg.goods to bbg.goods.url throws the same exception as bbg.goods. --~--~-~--~~~---~--~~ 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

Re: user registration

2006-07-17 Thread patrickk
you´re right - I only sent half of the code - will send a full example once I´m finished. I tried to use some of your code: now = datetime.now() new_user_data['date_joined_date'] = now.strftime("%Y-%m-%d") new_user_data['date_joined_time'] = now.strftime("%H:%M:%S") but got the error: combine(

Re: Using admin as the user interface

2006-07-17 Thread Akatemik
> i find it is easier to roll your own in a view rather than hack > admin. Since i use the same django for multiple sites, i like to > leave django stuff alone as i wouldnt want a separate dajngo for each > site Is there an easy way to have admin-like widgets? I'm especially fond of the collapsin

logged-in user id as default value on ForeignKey relation

2006-07-17 Thread Patrick J. Anderson
In my model I'd like to keep track of who added/updated a particular record. class Entry(models.Model): ... time_added = models.DateTimeField(auto_now_add = True, editable = False) user_added = models.ForeignKey(User, default = ?, editable = False) time_updated = models.DateT

Re: logged-in user id as default value on ForeignKey relation

2006-07-17 Thread Grigory Fateyev
Hello Patrick J. Anderson! On Mon, 17 Jul 2006 10:25:25 -0500 you wrote: > > In my model I'd like to keep track of who added/updated a particular > record. > > class Entry(models.Model): > ... > time_added = models.DateTimeField(auto_now_add = True, editable > = False) > user_add

Re: user registration

2006-07-17 Thread Aidas Bendoraitis
The problem is that you don't use manipulator.do_html2python(new_data) which transforms strings to appropriate values. In your case, you should write something like: new_user_data['date_joined'] = datetime.now() Aidas Bendoraitis [aka Archatas] On 7/17/06, patrickk <[EMAIL PROTECTED]> wrote: >

Re: logged-in user id as default value on ForeignKey relation

2006-07-17 Thread Patrick J. Anderson
Sorry, but would you be able to explain this in detail? I was thinking about acomplishing this in model classes, not in views, so I'm not sure if I understand what you mean. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

cherokee server and django - fast-cgi/scgi rumble

2006-07-17 Thread [EMAIL PROTECTED]
I found a small and nice web server called cherokee which supporst fast-cgi and scgi and I'm trying to run django on it. Server page: http://www.0x50.org/ ## SCGI is working -- 1. get djang-scgi.py from here: https://simon.bofh.ms/cgi-bin/trac-django-projects.c

Troubles migrating from old server

2006-07-17 Thread Elcio Ferreira
Hi, all, Excuse my bad english. I developed an application with Django some time ago. I was using svn code, rev. 1893. Now I need to migrate to a new server. On my old server I was using python 2.3.5 and mod_python 3.1.3. On my new server, with another ditro, I have python 2.4.2 and mod_python

Re: user registration

2006-07-17 Thread patrickk
thanks, I did use do_html2python ... but for the wrong manipulator (which, of course, is like not using it) ... patrick Am 17.07.2006 um 18:30 schrieb Aidas Bendoraitis: > > The problem is that you don't use manipulator.do_html2python(new_data) > which transforms strings to appropriate values

Re: cherokee server and django - fast-cgi/scgi rumble

2006-07-17 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > if settings.APPEND_SLASH and (old_url[1][-1] != '/') and ('.' not > in old_url[1].split('/')[-1]): > IndexError: string index out of range > -- > and in the browse flup shows a simillar bigger... What am I doing > wrong? :)

Javascript image preloading problems from tempates

2006-07-17 Thread Iain Duncan
Hello fellow djangoers. I've been doing a gallery site that is too image heavy for it's own good ( yes, I'm subcontracted by a graphic designer ... ), and am trying to find good ways to control image loading so that the user will wait and then see all the numerous and large images at the same time

Pre-processing Request Info in Generic View Wrapper

2006-07-17 Thread Paul Childs
I have written a wrapper around the object_list generic view. I would like to do some pre-processing before sending the information to the view. Here is my wrapper... ## from django.views.generic.list_detail import object_list def change_status(*args, **kwargs): pri

Re: Pre-processing Request Info in Generic View Wrapper

2006-07-17 Thread Paul Childs
Of course seconds after the post I ran across this... http://www.pointy-stick.com/blog/2006/06/29/django-tips-extending-generic-views/ Thanks go out to Malcolm Tredinnick. and this... http://code.djangoproject.com/browser/django/trunk/django/views/generic/list_detail.py Sorry to bother everyone.

Compilation of 30 Django tutorials

2006-07-17 Thread [EMAIL PROTECTED]
Hi all, I put together a compilation of 30 Django tutorials. They're mostly from the community page but I think it's nice to have them in a concise list. I also posted it onto digg so go digg it! Thanks to all the writers of the tuts. They've been and are really helpful to me. Direct link. http

psycopg2

2006-07-17 Thread [EMAIL PROTECTED]
Hi all, using django 0.9.5 on Windows with Python 2.4 with psycopg2 I'm receiving the following error: C:\www\myproject>python manage.py sql user Traceback (most recent call last): File "manage.py", line 11, in ? execute_manager(settings) File "c:\python24\lib\site-packages\django-0.95-

admin css

2006-07-17 Thread Vixiom
This is my second day using django so bear with me... I've figured out how to customize templates except for the css (and images). In 'mysite' I created an 'interface' folder to hold my templates and I have templates set up as mysite/interface/admin/templates and I changed settings.py as below

Graphviz Model Diagrams

2006-07-17 Thread Andrew
I started a simple little app to display a Graphviz diagram based off the Django models. It's simple and not so purty, but it's a start. It also requires graphviz to be installed and in the path. http://www.exit66.com/diagram.zip Install to to your Django server like any other app and the url

Extending User, inlining in Admin

2006-07-17 Thread pydj
Hi All I'm having a problem with extending User to include a couple of additional fields, and allowing them to be edited in the Admin module. I've followed the debate on http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model, and have the following model: class UserProfile (mod

Re: Image auto resizing

2006-07-17 Thread Enrico
Hi, I got it working in the model by using: from nesh.thumbnail.field import ImageWithThumbnailField But I couldn't apply the filter in the template. What is needed to use the filters? Nesh apps are in the "site-packages/nesh" Python Lib folder. The closer I got was loading the app "nesh.thumb

Re: psycopg2

2006-07-17 Thread Adrian Holovaty
On 7/17/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm receiving the following error: > > C:\www\myproject>python manage.py sql user > Traceback (most recent call last): > File "manage.py", line 11, in ? > execute_manager(settings) > File > "c:\python24\lib\site-packages\django-0.9

A few questions from a newbie.

2006-07-17 Thread Christian Wattengård
1. What is this SLUG thingy in every sourcecode I read? 2. How would I go about letting a user of my app do the following: * Upload a file (ex. a list of items with descriptions) * The file is parsed in the background * The items and descriptions are persisted to the db as if they were entered on

Re: Graphviz Model Diagrams

2006-07-17 Thread Jeremy Dunck
On 7/17/06, Andrew <[EMAIL PROTECTED]> wrote: > I started a simple little app to display a Graphviz diagram based off > the Django models. > > It's simple and not so purty, but it's a start. It also requires > graphviz to be installed and in the path. You might a settings option to specify the g

Re: A few questions from a newbie.

2006-07-17 Thread Scott McCracken
Christian Wattengård wrote: > 1. What is this SLUG thingy in every sourcecode I read? In response to your first question, a "slug" is a term taken from the newspaper industry, but in this case it means the final part of your URL - a clean and easy was to access your page. If your blog post was c

Re: cherokee server and django - fast-cgi/scgi rumble

2006-07-17 Thread [EMAIL PROTECTED]
I'll have to play with it a bit longer. Cherokee isn't that nicely documented ;) but SCGI works. Some experiments: http://www.cms.rk.edu.pl/benchmark_scgi.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djang

"no module named admin", webfaction

2006-07-17 Thread Raman Prasad
Hi, I have an admin setup question (I think I'm missing a basic step) I have some basic django code running on my laptop (local) which works fine but I'm having trouble moving it to a webfaction account. I used the screencast, etc but I'm getting a "no module named admin" error when trying

Re: Disable autoreload to allow single thread debugging

2006-07-17 Thread gjiro
Hi, Changeset 3348, adds the '--noreload' option for django_admin.py. "Added command line flag to disable use of auto-reloader on development server." Check http://code.djangoproject.com/changeset/3348 gjiro --~--~-~--~~~---~--~~ You received this message beca

Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick
On Mon, 2006-07-17 at 07:45 -0700, markguy wrote: > So, what you were *really* suggesting was that PYTHONPATH should > include the project directory, not the django_src directory? I saw that > while skimming through the docs. > > I changed PYTHONPATH to reflect that (apparently, adding both > dir

Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick
On Mon, 2006-07-17 at 07:34 -0700, markguy wrote: > > Malcolm Tredinnick wrote: > > > That should be easy enough to diagnose. My initial guess would be that > > bbg is in django_projects/, rather than django_src/, just from the way > > you named your directories. Remember that .bash_profile is o

Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick
On Mon, 2006-07-17 at 08:22 -0700, markguy wrote: > Changing bbg.goods to bbg.goods.url throws the same exception as > bbg.goods. So inside your project directory, try something like the following (I am pasting a terminal session using one of my own projects just to show what sort of output I see

Re: logged-in user id as default value on ForeignKey relation

2006-07-17 Thread Malcolm Tredinnick
On Mon, 2006-07-17 at 09:41 -0700, Patrick J. Anderson wrote: > Sorry, but would you be able to explain this in detail? I was thinking > about acomplishing this in model classes, not in views, so I'm not sure > if I understand what you mean. You have to pass the information through from a view, t

How to get django to show me the sql it executed recently?

2006-07-17 Thread Scott Chapman
I recall there's a way to do this but can't remember what it is. You could do something in the shell to get it. Please help my ailing memory! Scott p.s. Any chance this could be added to the Admin interface. It's the intuitive place for such things. --~--~-~--~~~---

Re: How to get django to show me the sql it executed recently?

2006-07-17 Thread Julio Nobrega
from django.db import connection for query in connection.queries: print query This one? On 7/17/06, Scott Chapman <[EMAIL PROTECTED]> wrote: > > I recall there's a way to do this but can't remember what it is. You could do > something in the shell to get it. Please help my ailing

Re: ImportError: No module named django

2006-07-17 Thread markguy
That fixed that particular issue. My unfamiliarity with Python lists betrayed me there. --~--~-~--~~~---~--~~ 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@googleg

Re: ImportError: No module named django

2006-07-17 Thread markguy
I've got my output at least resembling yours now, thanks to your explanation about the difference between URL config and apps. I'm using this for urlpatterns: ( r'^$' , 'django.views.generic.simple.direct_to_template' , { 'template' : 'index.html' } ) , However, there's a new wrinkle. While tryi

Re: How to get django to show me the sql it executed recently?

2006-07-17 Thread Malcolm Tredinnick
On Mon, 2006-07-17 at 18:44 -0700, Scott Chapman wrote: [...] > p.s. Any chance this could be added to the Admin interface. It's the > intuitive place for such things. Not a good idea. It's a security hole. You would be able to see every query people run just because you can log into admin -- a

Re: ImportError: No module named django

2006-07-17 Thread markguy
Okay, ./manage.py syncdb before ./manage.py sql goods is apparently a good idea. So, I've now got a very basic index page loading up as expected. I'm off for a couple drinks to see if I can wrap my head around how Django compartmentalizes things and then will endeavor to not bring many more prob

Re: ImportError: No module named django

2006-07-17 Thread Malcolm Tredinnick
On Mon, 2006-07-17 at 18:58 -0700, markguy wrote: > I've got my output at least resembling yours now, thanks to your > explanation about the difference between URL config and apps. > > I'm using this for urlpatterns: > ( r'^$' , 'django.views.generic.simple.direct_to_template' , { > 'template' :

Re: logged-in user id as default value on ForeignKey relation

2006-07-17 Thread Patrick J. Anderson
Malcolm Tredinnick wrote: > On Mon, 2006-07-17 at 09:41 -0700, Patrick J. Anderson wrote: >> Sorry, but would you be able to explain this in detail? I was thinking >> about acomplishing this in model classes, not in views, so I'm not sure >> if I understand what you mean. > > You have to pass the

Re: "no module named admin", webfaction

2006-07-17 Thread Harish Mallipeddi
Hi,Did you enable Admin in the project settings file? You need to enable it before you can start using it. Read the Django documentation to find out more info on this.Cheers,Harish On 7/18/06, Raman Prasad <[EMAIL PROTECTED]> wrote: Hi,I have an admin setup question (I think I'm missing a basic ste

Re: How to get django to show me the sql it executed recently?

2006-07-17 Thread Ian Holsman
http://zilbo.com/@perfmon captures this kind of information on a per- request basis. On 18/07/2006, at 12:06 PM, Malcolm Tredinnick wrote: > > On Mon, 2006-07-17 at 18:44 -0700, Scott Chapman wrote: > [...] >> p.s. Any chance this could be added to the Admin interface. It's the >> intuitive

Re: "no module named admin", webfaction

2006-07-17 Thread rp
Harish Mallipeddi wrote: > Hi, > > Did you enable Admin in the project settings file? You need to enable it > before you can start using it. Read the Django documentation to find out > more info on this. > > Cheers, > Harish > > On 7/18/06, Raman Prasad <[EMAIL PROTECTED]> wrote: > > > > > > Hi,

QuerySet

2006-07-17 Thread sasha
Hi, I must be missing something really obvious - QuerySets don't support negative notation, so what is then the right way of getting at the last item in the set? Thanks, Sasha --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: QuerySet

2006-07-17 Thread Jacob Kaplan-Moss
On Jul 18, 2006, at 12:04 AM, sasha wrote: > I must be missing something really obvious - QuerySets don't support > negative notation, so what is then the right way of getting at the > last > item in the set? Just order in the "other" direction. For example, to get the least expensive item in

Re: How to get django to show me the sql it executed recently?

2006-07-17 Thread Adrian Holovaty
On 7/17/06, Scott Chapman <[EMAIL PROTECTED]> wrote: > I recall there's a way to do this but can't remember what it is. You could do > something in the shell to get it. Please help my ailing memory! Hey Scott, Check out the answer here: http://www.djangoproject.com/documentation/faq/#how-can-

Re: QuerySet

2006-07-17 Thread Malcolm Tredinnick
On Tue, 2006-07-18 at 05:04 +, sasha wrote: > Hi, > > I must be missing something really obvious - QuerySets don't support > negative notation, so what is then the right way of getting at the last > item in the set? Two possibilities: (1) If you only want the last items and not the first it

Re: QuerySet

2006-07-17 Thread sasha
i'm trying to access the last record to loop over the query set. however somehow when i call on Something.objects.order_by("-id")[0] the set is truncated and it starts to loop over just the first and last objects. --~--~-~--~~~---~--~~ You received this message be

Re: QuerySet

2006-07-17 Thread Malcolm Tredinnick
On Tue, 2006-07-18 at 05:52 +, sasha wrote: > i'm trying to access the last record to loop over the query set. > however somehow when i call on Something.objects.order_by("-id")[0] the > set is truncated and it starts to loop over just the first and last > objects. Could you provide a slightl

Re: QuerySet

2006-07-17 Thread sasha
I have a gallery of images. I've written two views, one pulls the next image, one the previous. i'd like the views to loop, returning the the first image when the next method reaches the end an d the last when the previous method does. The next method loops fine, but the previous doesn't. Here's t

Re: QuerySet

2006-07-17 Thread sasha
I'm sorry this is the method I've been trying to use def previous(request, picture_id): artist_id = Picture.objects.select_related().get(id=picture_id).artist_id try: previous_picture_id = Picture.objects.filter(artist__id__exact=artist_id).filter(id__lt=picture_id