Re: newbie asks how to filter QuerySet of authors using first and last name at the same time

2007-05-24 Thread Mike Axiak
You need a little more power than what you're doing. My initial reaction would be to use operator and Q objects: from django.db.models import Q import operator Q_user_search = reduce(operator.or_, [Q(first = first, last=last) for (first, last) in authorList])

Re: Web Docs as a Single PDF Available

2007-05-24 Thread Russell Keith-Magee
On 5/25/07, Adam Fast <[EMAIL PROTECTED]> wrote: > Thanks, that's awesome. > > HOWEVER, I'm sorry to hear you did it the save as PDF many times way...I'd > like to show you a better way though. In Acrobat Pro, do File->Create > PDF->From Web Page. Give it ... or better still, use the source.

Re: reusing python objects

2007-05-24 Thread James Bennett
On 5/24/07, wesman <[EMAIL PROTECTED]> wrote: > I just don't want to have to write this stuff all again and > maintain two copies of it - can I use multi-inheritance and create a > model that is sub-classed from my "job" class and the models class? Sure. The only time you'll run into problems is

Re: reusing python objects

2007-05-24 Thread Doug B
Your proposed solution is exactly what I did. I think the official term is a 'mixin class'. It's worked out really well so far.In my case the mixin class looks for the Event class defined in the model for various settings. In your case they might contain a mapping between your mixin model

Re: Web Docs as a Single PDF Available

2007-05-24 Thread Adam Fast
Thanks, that's awesome. HOWEVER, I'm sorry to hear you did it the save as PDF many times way...I'd like to show you a better way though. In Acrobat Pro, do File->Create PDF->From Web Page. Give it http://www.djangoproject.com/documentation and however many link levels you'd like deep, step away

Any Django Powered Galleries out there for GNU?

2007-05-24 Thread Roboto
I'm looking for a gallery plugin for my community dragonboat website. Anyone have any ideas where I can find one so that my users can start posting their own pictures? Thanks, Robotooo --~--~-~--~~~---~--~~ You received this message because you are subscribed

newbie asks how to filter QuerySet of authors using first and last name at the same time

2007-05-24 Thread jmborr
Please help the newbie! I have a list of authors: authorList=( ('john','doe') , ('jane','smith') ) If I want to filter a table of authors (containing 'first' and 'last' fields) by their last name only, that much I know: Authors.objects.filter( last_in=[ last for (first,last) in

Web Docs as a Single PDF Available

2007-05-24 Thread simonb
If, like me, you're constantly referring to the docs on the web site when developing, you may enjoy the following: a single PDF of all the web docs from djangoproject.com. If you'd like a copy, it is available at the URL below. http://bnomis.googlepages.com/ Simon

Re: Sorting on calculated fields

2007-05-24 Thread Mike Axiak
Sorry, I meant to send this to the list. If it's small enough, you can just do a standard python sort: def sort_function(x, y): return cmp(x.calculated_field, y.calculated_field) query_list = list(queryset) query_list.sort(sort_function) If you want to use a Schwartzian

Re: Sorting on calculated fields

2007-05-24 Thread Tim Chase
> If I have a model that returns calculated fields, how would I sort a > query set on them? > > Assume the query sets are relatively small (< 100) for now. Give this condition (a small set of data) and no need to slice the results on the server based on this order, it can be done purely in

Re: Can you define an extra filter to be applied to a class in all cases via the model?

2007-05-24 Thread [EMAIL PROTECTED]
Thanks all... replied once to this, and it went to never never land. These are all along the same lines... Tim's suggestion is right on the money as to what I need ( changes in the model code and nowhere else). I'll try it out as soon as my DBA modifies the tables, which is hopefully soon. On

Re: GeoDjango Admin interface - Invalid HEX given!

2007-05-24 Thread Justin Bronn
> I'm just moving an application that we were writing over to the GeoDjango > branch Welcome! > However I am unable to add a new one using the admin ... > when attempting to create a new instance. You found a bug in WKTField -- good catch. > Any help would be much appreciated. Thanks It

Re: So how would YOU... (database question)

2007-05-24 Thread John M
Tim, Brilliant idea. I'm a car nut and what you've built would allow a Dyno to be plugged into his django app and record all the data for a particular car, and then just have a view that pulled out the max hp or torque. Very coolmultiple measurements associated with a given vehicle: > >

Sorting on calculated fields

2007-05-24 Thread John M
If I have a model that returns calculated fields, how would I sort a query set on them? Assume the query sets are relatively small (< 100) for now. Is this possible? Thanks john --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

On the subject of error messages...

2007-05-24 Thread Chris Brand
I had one yesterday that took a while to figure out. Every page that I visited gave me a similar error. Something like this : Request Method: GET Request URL:[host]/db/camps/ Exception Type: SyntaxError Exception Value:invalid syntax (views.py, line 76) Exception

Re: hmm django not very verbose on error messages

2007-05-24 Thread Malcolm Tredinnick
On Thu, 2007-05-24 at 20:50 +, rogerdpack wrote: > So it seems that if I run python manage.py syncdb > and it errs > it says > django.contrib.admin: name 'User' is not defined > django.contrib.auth: name 'User' is not defined > > turns out thta in django/contrib/auth/models.py on line 200 it

Re: Newforms makes unicode String from a dictonary

2007-05-24 Thread Malcolm Tredinnick
On Thu, 2007-05-24 at 20:20 +, Christian Schmidt wrote: > Hi, > > I have a form to upload a picture and i try to validate it in > newforms. But i can not read the content-type. I get the error > "'unicode' object has no attribute 'get'". > > I use Python 2.5. This is my code: > > view.py >

Re: Reverse URL resolver fails with a literal dot

2007-05-24 Thread Malcolm Tredinnick
On Thu, 2007-05-24 at 19:00 +0200, Olivier Guilyardi wrote: > Hi, > > In my urls.py I have the following entry: > > url(r'^items/download/(?P[0-9A-Za-z._:%?-]+)\.(?P[0-9a-z]+)$', > web_view.item_export, > name="telemeta-item-export"), > > In my template: > {% url

Re: Unicode-branch: testers wanted

2007-05-24 Thread Malcolm Tredinnick
On Thu, 2007-05-24 at 09:13 -0700, sandro dentella wrote: > Hi Malcom, > > I really welcome this branch and thank you all for the effort. > > Before I consider a bug what follows I'd ask if this should entitle > me to use > non ASCII letters in tests with test.client. > >I tried

Re: profiling django / import error: no module named profile

2007-05-24 Thread Jeremy Dunck
On 5/24/07, patrick k. <[EMAIL PROTECTED]> wrote: > > thanks david. it´s working now (although I´m having problems > interpreting the stats, but that´s another question). This should help: http://www.rkblog.rk.edu.pl/w/p/django-profiling-hotshot-and-kcachegrind/

Re: Can you define an extra filter to be applied to a class in all cases via the model?

2007-05-24 Thread Matt McClanahan
On May 24, 2:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > To accomplish this we are going to add a 'deleted_flag' to each table, > and set it to 0 if it is not deleted, and 1 if it is deleted. Just as an aside, when I use this approach I find it handy to use a date field,

Re: Can you define an extra filter to be applied to a class in all cases via the model?

2007-05-24 Thread Tim Chase
> To accomplish this we are going to add a 'deleted_flag' to > each table, and set it to 0 if it is not deleted, and 1 if it > is deleted. > > Rather than going to every function I am displaying items ( > 99% of the time I'm using .filter then some filter ), is there > a way to tell it in the

Re: Can you define an extra filter to be applied to a class in all cases via the model?

2007-05-24 Thread James Bennett
On 5/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Rather than going to every function I am displaying items ( 99% of the > time I'm using .filter then some filter ), is there a way to tell it > in the model to always append delete_flag=0 to any of the .filter > parameters I am passing

Can you define an extra filter to be applied to a class in all cases via the model?

2007-05-24 Thread [EMAIL PROTECTED]
Our CIO has just told us that we need to modify our application to perform 'logical' deletes on all items, instead of actually deleting them from the system as we've been doing. To accomplish this we are going to add a 'deleted_flag' to each table, and set it to 0 if it is not deleted, and 1 if

Re: Reverse URL resolver fails with a literal dot

2007-05-24 Thread akonsu
hello, i would say that yes it is a bug. i have seen many bugs in the reverse resolver code. for example, it crashes (throws a python exception) if a regex pattern contains question marks (optional elements) and i am sure it has a lot more. my personal opinoin is that this code is simply a hack.

Newforms makes unicode String from a dictonary

2007-05-24 Thread Christian Schmidt
Hi, I have a form to upload a picture and i try to validate it in newforms. But i can not read the content-type. I get the error "'unicode' object has no attribute 'get'". I use Python 2.5. This is my code: view.py ... postdata = request.POST.copy() if 'bild' in request.FILES:

Re: Unicode-branch: testers wanted

2007-05-24 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: > The unicode branch, [1], is now at a point where it is essentially > feature-complete and could do with a bit of heavy testing from the wider > community. Switched my site today to the branch. Works like a charm (translations, admin, multilingual content).

Re: So how would YOU... (database question)

2007-05-24 Thread Tim Chase
> First, hp and torque are both kinda meaningless unless you know where > they're at in the powerband, so I need hp "@" rpm (wherever the HP > peak is). Same for torque: torque lb.ft. @ rpm. > > Ideally, what I'd like is something that stores the values separately > (I can always return the

Re: Django Forms

2007-05-24 Thread Gerry Steele
> > What does the line "return HttpResponseRedirect("/places/edit/%i/" % > new_place.id)" mean? Why do we redirect to .../edit/... ? Does this > mean I have to create a view for this url? I am very confused about > this and I need clarification. Thanks. > The "/places/edit/%i/" will simply

Re: Unicode-branch: testers wanted

2007-05-24 Thread [EMAIL PROTECTED]
Thanks for your work! Definitely will test new branch soon & will tell the results. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: {{ perms }} seems to be empty

2007-05-24 Thread Jeremy Dunck
On 5/23/07, Michael Lake <[EMAIL PROTECTED]> wrote: ... > Oh I'll probably just be doing stuff like: > > {% if perms.lab.add_experiment %} > < a href="something">Click to add experiment. ... This should work. > Also I should ask: > return render_to_response('lab/user.html',

Re: need to know to start learn django

2007-05-24 Thread Nicola Larosa
Tim Chase wrote: > you might be able to get by with a point-and-drool GUI editor Am I the only one who finds this hysterically funny? B-D -- Nicola Larosa - http://www.tekNico.net/ I have a wonderful boyfriend. So how am I going to write a tortured break-up song? My life is really good and I

Re: Change admin widget

2007-05-24 Thread Grupo Django
I used to use tinymce too, but it doesn't generate well formed xhtml, and I found http://www.wymeditor.org/ which looks great, it's still very simple, but it has a lot of interesting features, and now It'll become a jquery plugin, and that's great because I use to work with jquery. Anyway, I must

Middleware tests location

2007-05-24 Thread Eugene Morozov
Hello, I have a custom middleware class that would be used project-wide. I've put it in the 'middleware' subdirectory of my project because it doesn't really belong to any app. The question is where to put tests for such code that exists outside of any application? Django default test runner

Reverse URL resolver fails with a literal dot

2007-05-24 Thread Olivier Guilyardi
Hi, In my urls.py I have the following entry: url(r'^items/download/(?P[0-9A-Za-z._:%?-]+)\.(?P[0-9a-z]+)$', web_view.item_export, name="telemeta-item-export"), In my template: {% url telemeta-item-export item.id|urlencode,format.extension %} For item.id = "BM.001:006" and

Re: profiling django / import error: no module named profile

2007-05-24 Thread patrick k.
thanks david. it´s working now (although I´m having problems interpreting the stats, but that´s another question). for everyone who´s reading this, here´s more about the python- profiler on debian: http://mail.python.org/pipermail/tutor/2005-March/036677.html thanks, patrick Am 24.05.2007

RE: {{ perms }} seems to be empty

2007-05-24 Thread Chris Brand
> I guess you're looking for any permissions that are for the 'lab' app? > > Consider moving this into the view or writing a template tag-- There's > not an easy way to do str.startswith in a template, which is what > you'd need here. I thought you could do {% if perms.lab %} for "any

Django Forms

2007-05-24 Thread robo
Hi everyone. for the code below at http://www.djangoproject.com/documentation/forms/ def create_place(request): manipulator = Place.AddManipulator() if request.method == 'POST': # If data was POSTed, we're trying to create a new Place. new_data = request.POST.copy()

Re: Unicode-branch: testers wanted

2007-05-24 Thread sandro dentella
Hi Malcom, I really welcome this branch and thank you all for the effort. Before I consider a bug what follows I'd ask if this should entitle me to use non ASCII letters in tests with test.client. I tried something like self.client.get(url, dict(name=u'F\xf2')) to get back an error

Re: profiling django / import error: no module named profile

2007-05-24 Thread David Reynolds
Patrickk, On 24 May 2007, at 2:15 pm, patrickk wrote: I´m just trying to do some profiling based on http://code.djangoproject.com/wiki/ProfilingDjango when trying to import hotshot.stats I´m getting this: Traceback (most recent call last): File "", line 1, in ? File

Re: Music E-zine development in Django

2007-05-24 Thread Austin Govella
On Apr 13, 10:46 am, "temnoregg" <[EMAIL PROTECTED]> wrote: > i sent you private mail that I am interested, but without response... Sorry. Your last message disappeared somewhere in my inbox. I've refactored the code to separate the news from features (like interviews or longer articles), and I

Re: Change admin widget

2007-05-24 Thread Michel Thadeu Sabchuk
Hi I use tinymce too, what rich text editor would you use (just to know another options)? Best regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Where did you put your homepage view?

2007-05-24 Thread Michel Thadeu Sabchuk
Index page doesn't need a view. Generally it is a static page, if it have some dynamic data, it access through template tags. So, I follow this structure: project/ project/templates/ project/templates/main/ project/templates/main/base.html project/templates/main/index.html

Re: conditional block tag

2007-05-24 Thread Trey
No, I have tried that and it looks for a header variable in your template context. It doesn't check if the block exists. On May 23, 11:15 pm, David Robinson <[EMAIL PROTECTED]> wrote: > I'm probably missing something about your question, and please excuse me > if that's the case, but wouldn't

Re: Change admin widget

2007-05-24 Thread Grupo Django
You are right, I didn't know about add javascript in the model definition, is good to know it :-) I was thinking about doing an admin zone using a bit more of Ajax, and autoload a select widget depending of a previous select... stuff like that. First I thought that I could create a second admin

profiling django / import error: no module named profile

2007-05-24 Thread patrickk
I´m just trying to do some profiling based on http://code.djangoproject.com/wiki/ProfilingDjango when trying to import hotshot.stats I´m getting this: Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/hotshot/stats.py", line 3, in ? import profile

Re: Best Place To Start Learning Django/Python

2007-05-24 Thread waylan
On May 24, 7:30 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 5/23/07, Kelvin Nicholson <[EMAIL PROTECTED]> wrote: > > > > > Peter Pluta wrote: > > > > I don't really have any programming experience outside of hacking up a few > ... > > > Don't forget to look

Unicode-branch: testers wanted

2007-05-24 Thread Malcolm Tredinnick
Hi folks, The unicode branch, [1], is now at a point where it is essentially feature-complete and could do with a bit of heavy testing from the wider community. So if you have some applications that work against Django's current trunk and would like to try them out on the unicode branch, I'd

Re: Generell Questions on Django

2007-05-24 Thread brian corrigan
We have used Django along side Java applications by using Jython and HTTP requests from the Java to Django and vice versa. So if your colleagues need more "serious" application features there are ways to plug them into Django (although I'm sure some people might not agree with the method) :) On

Re: Best Place To Start Learning Django/Python

2007-05-24 Thread Jeremy Dunck
On 5/23/07, Kelvin Nicholson <[EMAIL PROTECTED]> wrote: > > Peter Pluta wrote: > > > > I don't really have any programming experience outside of hacking up a few ... > > Don't forget to look into: http://www.diveintopython.org/ I love DiP, but I definitely feel it assumes you know a good bit

Serving media files from Apache to specific users

2007-05-24 Thread Alexey Maksimov
Hi! The documentation here: http://www.djangoproject.com/documentation/apache_auth/ describes how to serve media files from Apache to authenticated users. How to implement anti-robot protection here? When user wants to download a file I show him some picture with code on it and then I want to

Re: decimal fields + json serializing [was Re: Decimal fields have landed on trunk: rename your FloatFields]

2007-05-24 Thread Bram - Smartelectronix
Hello Malcolm, Malcolm Tredinnick wrote: > Pleasee file a ticket with a small, self-contained, repeatable example > that demonstrates the problem. Reporting ticket son the mailing list is > a good way to have them forgotten about. > > I did test JSON serialisation of decimals, so it doesn't

Re: Komodo and Django - code completion / code intellisensing

2007-05-24 Thread ro
On 5/23/07, oliver <[EMAIL PROTECTED]> wrote: > > I have given up on komodo for now and moved to WingIDE. > It does the code completion quite well, not to the extend that i would > prefer as in including django specific functions. (if any one knows > how to do that in wingide ??? would be handy!)

Re: Admin page without formatting and looks

2007-05-24 Thread [EMAIL PROTECTED]
thanks Kelvin it really worked. thank you very much Dushyant Sharma --~--~-~--~~~---~--~~ 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

Cannot update model instance in views but works in admin ( UnicodeEncodeError ) - FIXED

2007-05-24 Thread Sam
I use .96, UTF-8. I couldn't update a user instance with strings containing unicode special characters in my views but it worked with the admin interface. Some of you may encounter this problem, so here is the solution... I got this error : UnicodeEncodeError at /profile/xxx/edit/ 'ascii'

Re: Best Place To Start Learning Django/Python

2007-05-24 Thread Kelvin Nicholson
Peter Pluta wrote: > > I don't really have any programming experience outside of hacking up a few > lines of php, but it'd like to start learning python and the django web > framework. I haven't been able to find too many intuitive guides like those > for php, so i'd thought i'd ask here. Does

Re: Admin page without formatting and looks

2007-05-24 Thread Kelvin Nicholson
now when i start admin page it > shows plain page without any look and feel. [snip] > > Alias /media/ "/usr/local/lib/python2.5/site-packages/django/contrib/ > admin/media/" > My .02: are you running the media files off the same server as django? You might need to try:

Re: Where did you put your homepage view?

2007-05-24 Thread David Larlet
2007/5/23, David Larlet <[EMAIL PROTECTED]>: > Hi, > > I'm juste curious, where did you put your homepage view when you've > got a project with a lot of apps? Is there a best practice here? > Thanks a lot for your answers! David --~--~-~--~~~---~--~~ You

Re: Displaying my table data

2007-05-24 Thread Kelvin Nicholson
c = Choice.objects.filter(choice=1) c > [, , ] c.size.name > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'QuerySet' object has no attribute 'size' > > I still can't access the size and price's tied to style number 89b. I > thought that

Re: Data truncated for column 'user_id' at row 1

2007-05-24 Thread Michael Newman
Wow, Thanks for the quick reply. Here I was restructuring my SQL and everything and it was a simple name problem. On May 24, 2:19 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2007-05-24 at 06:10 +, Michael Newman wrote: > > This is appearing

Re: Data truncated for column 'user_id' at row 1

2007-05-24 Thread Malcolm Tredinnick
On Thu, 2007-05-24 at 06:10 +, Michael Newman wrote: > This is appearing at http://speakeasymag.com/staff/Mgnewman > > I have been adjusting the SQL a bit but really don't understand why > this error keeps appearing. I did a search and most people who had > this problem were dealing with

Re: newforms: how to report multiple cross-field validation errors?

2007-05-24 Thread Mario Graziosi
Great, I'll do that. I didn't realized that ValidationError might get a list of error messages and not just a single error message. Thanks for your help, Malcom. Malcolm Tredinnick wrote: > On Wed, 2007-05-23 at 10:16 -0700, mario wrote: > >> I'm using newforms library and it is really a

Re: Displaying data in the admin using list_display

2007-05-24 Thread Malcolm Tredinnick
On Wed, 2007-05-23 at 22:30 -0700, Greg wrote: > Malcolm, > So how do I call a method in my list_display? At some point I think I'm justified in saying "please read the documentation." I mean, this is all explained in the docs for list_display in the Admin class. That should be your first port

Re: conditional block tag

2007-05-24 Thread Michael Newman
You can also not put anything inside of the {% block header %} and then when nothing is provided nothing will show up. On May 23, 11:15 pm, David Robinson <[EMAIL PROTECTED]> wrote: > I'm probably missing something about your question, and please excuse me > if that's the case, but wouldn't you