A way to specify different template code for every 6th item in a list?

2009-05-01 Thread Chris O'Donnell
I'm using the Blueprint CSS framework and need to be able to have every 6th list item processed with different code than every 1st-5th. I guess you could do some sort of "is divisible by 6" thing, but I'm not sure exactly what's entailed to get the job done. New to Django, if you haven't noticed.

Re: Displaying rows as columns

2009-05-01 Thread Lars Stavholm
mamco wrote: > Hi, > In attempting to get a better grasp of Django, I'm attempting a fairly > simple timecard app. Multiple users of a small chain of retail > stores, where occasionally the employees jump between stores(company), > and between projects and activities. > > The interesting model i

Re: Help beginner again: templatetags.

2009-05-01 Thread zayatzz
> This is a major clue. Even if nothing was returned from your template tag > the paragraph text would still show up. My bet is that you don't have a > Block 'arts' in the "front/index.html." You will need that if you want it to > display. > Seehttp://docs.djangoproject.com/en/dev/topics/template

Re: Proper way to rescue transaction after IntegrityError using postgres?

2009-05-01 Thread Karen Tracey
On Fri, May 1, 2009 at 9:02 PM, Charlie DeTar wrote: > I am indeed using the latest trunk (R10651). I'm actually not > particularly interested in testing commit or rollback; though thanks > for the pointer, that helps for the future. I'm really just > interested in testing cases which raise Int

Re: Displaying rows as columns

2009-05-01 Thread George Song
On 5/1/2009 5:47 PM, mamco wrote: > Hi, > In attempting to get a better grasp of Django, I'm attempting a fairly > simple timecard app. Multiple users of a small chain of retail > stores, where occasionally the employees jump between stores(company), > and between projects and activities. > > Th

Re: Proper way to rescue transaction after IntegrityError using postgres?

2009-05-01 Thread Charlie DeTar
> What is the proper way to "reset" or "rollback" the connection in a > test case after an IntegrityError has been raised? This only seems to > be an issue with PostgresSQL; in sqlite the "current transaction is > aborted, commands ignored" doesn't seem to come up. > > > What vers

Displaying rows as columns

2009-05-01 Thread mamco
Hi, In attempting to get a better grasp of Django, I'm attempting a fairly simple timecard app. Multiple users of a small chain of retail stores, where occasionally the employees jump between stores(company), and between projects and activities. The interesting model is something like this: cla

Re: Proper way to rescue transaction after IntegrityError using postgres?

2009-05-01 Thread Karen Tracey
On Fri, May 1, 2009 at 1:44 PM, Charlie DeTar wrote: > > Hi, > > I'm writing tests for an application, and want to test cases where > IntegrityError's get raised. However, whenever an IntegrityError > comes up, I can't get the test client to recover -- it always fails > with: > > InternalError:

Re: url template tag help

2009-05-01 Thread TheCorp
Just ran into a URLs tag issue myself figured id add onto this discussion to reveal a little tidbit that's very important. Be VERY VERY careful of errors in your urls.py file. I was dealing with an issue like this all day and realized I had some incorrect syntax in my urls.py. Things seemed to be

cannot save in the admin site

2009-05-01 Thread Lame Spirale
Hello, I'm using Django 1.1 beta / firefox 3 / ubuntu jaunty When i go in the admin site i cannot save anything. The "save" buttons don't work at all, they don't do anything, for any table. It use to work but today i deleted my sqlite3 db and recreated it using syncdb and the problem appeared.

Re: "DeprecationWarning: the sets module is deprecated"

2009-05-01 Thread nbv4
The problem was it wasn't creating the tables like it should, all it did was spit out that warning. I assumed that the warning was the reason the tables weren't created. But I just now realized the reason the tables weren't being created was because I forgot to add the app in the settings.py file.

Re: Django equivalent to a SQL CASE statement?

2009-05-01 Thread Malcolm Tredinnick
On Fri, 2009-05-01 at 13:49 -0700, jrs_66 wrote: > Thanks! Very helpful! > > Any idea where a very experienced SQL coder can find a few details > beyond the three pages of model/queryset documentation? Such as > information on a) SQL CASE statements (or equivalent), b) performing > LEFT JOINs (

Re: "DeprecationWarning: the sets module is deprecated"

2009-05-01 Thread Malcolm Tredinnick
On Fri, 2009-05-01 at 14:59 -0700, nbv4 wrote: > Whenever I run the syncdb command, I get this error: > > ch...@chris-desktop:~/Websites/jobmap$ python manage.py syncdb > /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: > DeprecationWarning: the sets module is deprecated > from sets im

Re: "DeprecationWarning: the sets module is deprecated"

2009-05-01 Thread Alex Koshelev
You see MySQLdb warning not Django. May be you are using MySQLdb version that is not full compatible with Python 2.6 On Sat, May 2, 2009 at 1:59 AM, nbv4 wrote: > > Whenever I run the syncdb command, I get this error: > > ch...@chris-desktop:~/Websites/jobmap$ python manage.py syncdb > /var/li

"DeprecationWarning: the sets module is deprecated"

2009-05-01 Thread nbv4
Whenever I run the syncdb command, I get this error: ch...@chris-desktop:~/Websites/jobmap$ python manage.py syncdb /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated from sets import ImmutableSet I'm using Python 2.6 on Ununtu 9.04. I s

Re: Django equivalent to a SQL CASE statement?

2009-05-01 Thread Malcolm Tredinnick
On Fri, 2009-05-01 at 14:27 -0700, Malcolm Tredinnick wrote: [...] > Again, provide some details about the problem(s) you're trying to solve > and we can help. Email is always hard to interpret, since it doesn't include body language. If there's any confusion about the intent of my words: I'm *no

Re: Django equivalent to a SQL CASE statement?

2009-05-01 Thread Phil Mocek
On Fri, May 01, 2009 at 01:49:55PM -0700, jrs_66 wrote: > On May 1, 2:03 pm, Malcolm Tredinnick wrote: > > So what's the model-related situation where a case-statement is > > going to be necessary? I know some exist, but I'm interested in > > which particular problem you're trying to solve so that

Prepopulating slug from foreign key

2009-05-01 Thread Xiong Chiamiov
I have these two models: class CoursePrefix(models.Model): prefix = models.CharField(max_length=6) title = models.CharField(max_length=40, blank=True) department = models.ForeignKey(Department) def __str__(self): return self.prefix class Meta: verbose_name_pl

Re: Django equivalent to a SQL CASE statement?

2009-05-01 Thread jrs_66
Thanks! Very helpful! Any idea where a very experienced SQL coder can find a few details beyond the three pages of model/queryset documentation? Such as information on a) SQL CASE statements (or equivalent), b) performing LEFT JOINs (or equivalent). Would studying the source code be my best op

Re: Help beginner again: templatetags.

2009-05-01 Thread Malcolm Tredinnick
Probably not necessary to start each title with "help" (which is pretty much implicit in the fact that there's a question asked on the list) or "beginner" (which isn't particularly helpful to us, as it could mean antyhing). Just a note for the future. :-) On Fri, 2009-05-01 at 12:16 -0700, zayatz

Re: Help beginner again: templatetags.

2009-05-01 Thread Michael
On Fri, May 1, 2009 at 4:07 PM, zayatzz wrote: > > As far as i know all templatetag errors fail silently (true?) Actually templatetags can throw errors in the templates by, well, throwing an uncaught exception (try the url tag that doesn't have a reverse without 'as' in it). So if there was an

Re: Help beginner again: templatetags.

2009-05-01 Thread zayatzz
As far as i know all templatetag errors fail silently (true?) In any case im not getting an error, but i dont get this paragraph with The time is text either. Just in case you need view code too - ill post it here. def index(request): if 'language' not in request.session:

Re: Help beginner again: templatetags.

2009-05-01 Thread Michael
On Fri, May 1, 2009 at 3:16 PM, zayatzz wrote: > > Hello > > In order to find more about django i proceeded to try creating > templatetags. I decided to follow custom templatetag examples at > djangoproject and djangobook (they are slightly different in both > compliation and renderer part). > >

Help beginner again: templatetags.

2009-05-01 Thread zayatzz
Hello In order to find more about django i proceeded to try creating templatetags. I decided to follow custom templatetag examples at djangoproject and djangobook (they are slightly different in both compliation and renderer part). In any case the outcome is that the example described there does

Re: User Profile in Admin

2009-05-01 Thread Kevin Audleman
Can't answer your question directly, but it looks as if you are trying to extend the field list for a user. In this case you should check out the proper way of doing it using AUTH_PROFILE_MODULE: http://docs.djangoproject.com/en/dev/topics/auth/?from=olddocs#storing-additional-information-about-u

Re: Proper way to rescue transaction after IntegrityError using postgres?

2009-05-01 Thread Charlie DeTar
> What is the proper way to "reset" or "rollback" the connection in a > test case after an IntegrityError has been raised? This only seems to > be an issue with PostgresSQL; in sqlite the "current transaction is > aborted, commands ignored" doesn't seem to come up. To make this more concrete, he

Re: url template tag help

2009-05-01 Thread Kevin Audleman
Malcom, Cheers to that. It's always hard to figure out what attitude you are conveying when you post to a message board so I don't know how I sound in this thread. Forgive me if I sound whiny or complainy, that is certainly not my intent. Quite the contrary, my overall attitude toward Django is

Re: url template tag help

2009-05-01 Thread Malcolm Tredinnick
On Fri, 2009-05-01 at 11:28 -0700, Malcolm Tredinnick wrote: [...] > Certainly the error reporting from some of the URL resolving is a little > weak and that's something we're going to fix at some point. Hopefully > before 1.1 comes out. So bear with us for a little while longer on that > front an

Re: url template tag help

2009-05-01 Thread Malcolm Tredinnick
On Fri, 2009-05-01 at 11:13 -0700, Kevin Audleman wrote: > > > I can't explain any of this, but I've been thinking about your > > question since you posted it beause I know this type of error happens > > to me a lot (and indeed has been hard to debug), but I couldn't put my > > finger on remember

Re: url template tag help

2009-05-01 Thread Kevin Audleman
> I can't explain any of this, but I've been thinking about your > question since you posted it beause I know this type of error happens > to me a lot (and indeed has been hard to debug), but I couldn't put my > finger on remembering what my solution was.  It just happened, I fixed > my syntax er

Re: Django equivalent to a SQL CASE statement?

2009-05-01 Thread Malcolm Tredinnick
On Fri, 2009-05-01 at 10:48 -0700, jrs_66 wrote: > Hi, > > Any pointers as to where I could find any info about performing a SQL > CASE statement using Django? Even more fundamental... is there really > no way of doing a LEFT OUTER JOIN in Django (other than terribly > sloppy role your own hacks

Django equivalent to a SQL CASE statement?

2009-05-01 Thread jrs_66
Hi, Any pointers as to where I could find any info about performing a SQL CASE statement using Django? Even more fundamental... is there really no way of doing a LEFT OUTER JOIN in Django (other than terribly sloppy role your own hacks)? Does anyone know of any more complete model/queryset docs

Proper way to rescue transaction after IntegrityError using postgres?

2009-05-01 Thread Charlie DeTar
Hi, I'm writing tests for an application, and want to test cases where IntegrityError's get raised. However, whenever an IntegrityError comes up, I can't get the test client to recover -- it always fails with: InternalError: current transaction is aborted, commands ignored until end of transact

Re: getting a single record

2009-05-01 Thread Daniel Roseman
On May 1, 4:59 pm, deostroll wrote: > Hi, > > Suppose if I want to edit a contact in my contact book, I am able to > initiate the appropriate command because I know the primary key value. > How do you get the data pertaining to this key value in your python > code? Ultimate aim is to load a web f

Re: Newbie Tutorial Question Part 4

2009-05-01 Thread arfinsd
Got it, shouldn't be hitting /polls Since we put in the object_id Alex On May 1, 8:57 am, arfinsd wrote: > Have a newbie question. I'm stuck on the tutorial and keep getting a > 404 error when I try to hit:http://127.0.0.1:8000/polls > > My files are listed below, does anyone see something tha

getting a single record

2009-05-01 Thread deostroll
Hi, Suppose if I want to edit a contact in my contact book, I am able to initiate the appropriate command because I know the primary key value. How do you get the data pertaining to this key value in your python code? Ultimate aim is to load a web form, with appropriate data in the form... --deo

Newbie Tutorial Question Part 4

2009-05-01 Thread arfinsd
Have a newbie question. I'm stuck on the tutorial and keep getting a 404 error when I try to hit: http://127.0.0.1:8000/polls My files are listed below, does anyone see something that I'm doing wrong? URLS.py #-- # Uncomment the next two lines to enable the admin

Re: Tables with same schema

2009-05-01 Thread Ramashish Baranwal
> Plain ol' Python multiple inheritance should work. Just define the > fields you want in some class: > {{{ > class PersonMixin(object): >     first = models.CharField(max_length=16) >     last = models.CharField(max_length=16) > > class Person(models.Model, PersonMixin): >     pass > > class Pers

User Profile in Admin

2009-05-01 Thread CrabbyPete
I created the following: class Profile(models.Model): user= models.ForeignKey(User, unique=True) phone = models.CharField(max_length=15, blank = True, null = True, unique = True) def __unicode__(self): return self.user.username But when I look at it in the Adm

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread Jason Sypolt
I completely removed pil from my system and rebuilt it with --force and now it seems to be working. Thanks for the help! On May 1, 10:23 am, George Song wrote: > Can you try the same operation using the Django development server and > see what happens? > > On 5/1/2009 7:19 AM, Jason Sypolt wrote

Re: save_formset() in admin.TabularInline doesn't work.

2009-05-01 Thread eli
Ok, I overloaded save_formset in BAdmin and everything works fine. Thank You. On 1 Maj, 16:46, George Song wrote: > On 5/1/2009 4:29 AM, eli wrote: > > > > > Hi, > > > I have problem with save_form, save_model, save_formset methods in > > Admin class admin.TabularInline. > > > class AAdmin(admi

Re: save_formset() in admin.TabularInline doesn't work.

2009-05-01 Thread George Song
On 5/1/2009 4:29 AM, eli wrote: > Hi, > > I have problem with save_form, save_model, save_formset methods in > Admin class admin.TabularInline. > > class AAdmin(admin.TabularInline): > model = A1 > extra = 3 > > def save_form(self, request, form, change): > print "form" >

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread George Song
Can you try the same operation using the Django development server and see what happens? On 5/1/2009 7:19 AM, Jason Sypolt wrote: > Also, I'm going through wsgi and not mod_python. Not sure if that > makes a difference.. > > > On May 1, 10:12 am, George Song wrote: >> On 5/1/2009 6:56 AM, Jas

Re: Create a web service for an existing stand alone python script

2009-05-01 Thread George Song
On 5/1/2009 5:13 AM, pallavi wrote: > For example lets say my python script is named "science.py" and it > reads two input files for the input data : abc.txt and xyz.txt and > after computation the output file is : output.txt If abc.txt and xyz.txt are available somehow directly on the applicati

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread Jason Sypolt
Also, I'm going through wsgi and not mod_python. Not sure if that makes a difference.. On May 1, 10:12 am, George Song wrote: > On 5/1/2009 6:56 AM, Jason Sypolt wrote: > > > I have pil 1.1.6 installed - it can find a jpeg decoder and all tests > > pass. I'm using django 1.0.2 and python 2.5 on

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread Jason Sypolt
Yes, and everything looks to be installed correctly under site- packages. I guess django can find everything ok too, otherwise I'd probably get an import error. On May 1, 10:12 am, George Song wrote: > On 5/1/2009 6:56 AM, Jason Sypolt wrote: > > > I have pil 1.1.6 installed - it can find a jpeg

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread George Song
On 5/1/2009 6:56 AM, Jason Sypolt wrote: > I have pil 1.1.6 installed - it can find a jpeg decoder and all tests > pass. I'm using django 1.0.2 and python 2.5 on centos 5.3. Whenever I > try to upload a jpeg via the admin (ImageField), I get the following > validation error. > > "Upload a valid i

Re: Trouble iterating through QuerySet

2009-05-01 Thread Kristian R. Van Tassell
Thanks! On May 1, 8:47 am, Karen Tracey wrote: > On Fri, May 1, 2009 at 9:28 AM, Kristian R. Van Tassell < > > > > k.vantass...@gmail.com> wrote: > > > I'm attempting to iterate through each "User" and get a list of > > "Events" for each user. I feel that my code below is sound, but Django > > d

Re: Saving Multiple forms? or fields... confused.

2009-05-01 Thread tdelam
Hi Karen, Thanks a lot for such an elaborate answer. I took your advice and stepped back a few steps. I needed to plan it out better. What I was ultimately doing prior to this post was just trying to get it to save and then add the other features later, features that should really be required fro

Validation error when uploading jpeg via admin

2009-05-01 Thread Jason Sypolt
I have pil 1.1.6 installed - it can find a jpeg decoder and all tests pass. I'm using django 1.0.2 and python 2.5 on centos 5.3. Whenever I try to upload a jpeg via the admin (ImageField), I get the following validation error. "Upload a valid image. The file you uploaded was either not an image o

Re: slug field not populated on form save

2009-05-01 Thread Gabriel
Malcolm Tredinnick escribió: > The Model class calls pre_save() to work out the value to save into the > database. That's working correctly for you, as you've noticed: the right > value is being saved. > > Some Field subclasses in Django also use pre_save() as a way to > normalise the value in th

Re: Trouble iterating through QuerySet

2009-05-01 Thread Karen Tracey
On Fri, May 1, 2009 at 9:28 AM, Kristian R. Van Tassell < k.vantass...@gmail.com> wrote: > > I'm attempting to iterate through each "User" and get a list of > "Events" for each user. I feel that my code below is sound, but Django > doesn't agree (I'm not using a template because I'm just doing a p

Trouble iterating through QuerySet

2009-05-01 Thread Kristian R. Van Tassell
I'm attempting to iterate through each "User" and get a list of "Events" for each user. I feel that my code below is sound, but Django doesn't agree (I'm not using a template because I'm just doing a proof of concept at this point, hence the direct HttpResponse(eventList)). I'm getting this error

Re: Saving inline objects

2009-05-01 Thread Tom Evans
On Fri, 2009-05-01 at 05:11 -0700, Alfonso wrote: > I've got a very simple Order model and an invoice model. Currently > within the admin section, the invoice admin page contains associated > orders as an edit_inline. The user adds orders to the invoice by > clicking 'save and continue editing'

Create a web service for an existing stand alone python script

2009-05-01 Thread pallavi
Dear Django Users and Developers, I am very new to this world of web services and also python. I was reading about django and could not find solution for my problem. I hope anyone from this community can help me with the solution. I have a python application This python script contain some modul

Saving inline objects

2009-05-01 Thread Alfonso
I've got a very simple Order model and an invoice model. Currently within the admin section, the invoice admin page contains associated orders as an edit_inline. The user adds orders to the invoice by clicking 'save and continue editing' at which point the system pulls through the correct price

save_formset() in admin.TabularInline doesn't work.

2009-05-01 Thread eli
Hi, I have problem with save_form, save_model, save_formset methods in Admin class admin.TabularInline. class AAdmin(admin.TabularInline): model = A1 extra = 3 def save_form(self, request, form, change): print "form" return form.save(commit=False) def save_model

Re: Ajax and https

2009-05-01 Thread Zain Memon
You cannot make cross-site requests in Javascript, for security reasons. See: https://developer.mozilla.org/en/Same_origin_policy_for_JavaScript This has nothing to do with Django, however, so if you need further information, you should take your question to the JQuery mailing lists. Zain On Thu

Re: Help - Adding Model String Representations

2009-05-01 Thread Daniel Roseman
On May 1, 8:00 am, gforce wrote: > Hi, > > I am having problem getting the Model String Representation working > following the Djangobook 2.0. I can save and add records no problems. > > I have > > Django (installed from svn)  (1, 1, 0, 'beta', 1) > > Mysql 5x > Python 2.5.4 > > I have followed t

Help - Adding Model String Representations

2009-05-01 Thread gforce
Hi, I am having problem getting the Model String Representation working following the Djangobook 2.0. I can save and add records no problems. I have Django (installed from svn) (1, 1, 0, 'beta', 1) Mysql 5x Python 2.5.4 I have followed the model view using "def __unicode__(self):" but in adm

Re: Tables with same schema

2009-05-01 Thread George Song
Plain ol' Python multiple inheritance should work. Just define the fields you want in some class: {{{ class PersonMixin(object): first = models.CharField(max_length=16) last = models.CharField(max_length=16) class Person(models.Model, PersonMixin): pass class Person2(models.Model, Pe