Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 19:44 CET, Robert Wittams wrote: All beyond here is a hack! = I think the least bad monkey patch you could do is probably the following (untested): def add_thumbnailing(_post_save = None, _post_delete = None): def new_postsave(self): th

Subquery support in DB lookup

2005-12-01 Thread Russell Keith-Magee
Hi all, I originally posted this in django-users as the tail end of a longer discussion, but in retrospect, this is probably a better forum. I have been looking at the code for function_get_sql_clause() recently while working on a patch for quoting behaviour for subselects in "tables" clauses (n

Re: Database querying in Django

2005-12-01 Thread Brant Harris
I think the arguing about the color of the bikeshed thought is mis-placed here. I'm not offering feedback, i.e. arguing that the bikeshed is painted the wrong color, I'm offering an idea, a patch, real code. But, I obviously didn't present my idea well enough, so I will present it in wiki form o

Re: Database querying in Django

2005-12-01 Thread Jacob Kaplan-Moss
Hey Brent -- Thanks for your feedback. However, as I see it, arguing about the syntax that an ORM should use is just a rehashing of the argument over what color to paint the bikeshed (http://www.unixguide.net/freebsd/faq/16.19.shtml). The fact is that there's a serious mismatch between p

Re: Database querying in Django

2005-12-01 Thread Brant Harris
Alright, I'll get up a ticket as soon as I can.

Re: Database querying in Django

2005-12-01 Thread oggie rob
Yes, it is a little ugly. I would suggest that you put the Q arguments outside of your query for readability (also for those 'subqueries' you were talking about): hello = Q(headline__startswith='Hello') bye = Q(headline__startswith='Goodbye') articles.get_list(complex=(hello | goodbye)) As usual,

Re: Database querying in Django

2005-12-01 Thread Robert Wittams
Brant Harris wrote: > > SQL: > SELECT * FROM `documents` WHERE ((something > 2 AND other < 4 AND > other LIKE 'hi%') OR (something < 4)) > > I've coded this out completely, so it's not a pipe-dream. If there is > more interest I can provide such code. > It'd be interesting to look at. I for

Re: Database querying in Django

2005-12-01 Thread Eugene Lazutkin
I've read it. I think the author is under false impression that ORM is supposed to provide better/simpler alternative to SQL. It is not the goal of ORM. ORM is about bridging SQL with systems written in conventional computer languages. Usually it is assumed that the system is OO-based, hence O

Database querying in Django

2005-12-01 Thread Brant Harris
Jonathan Ellis left a pretty brutal attack about Django's ORM on his blog today that I picked up from Planet Python, and I got to thinking about it. I don't quite agree with him on many of his points. But I did agree that the OR syntax, as it stands, is rather ugly. So I was trying to think of

Ticket #714

2005-12-01 Thread Afternoon
I'd like to have a go at creating a fix for ticket #714: access to id of current user on admin. I have no idea what I'm doing though. Could anyone offer some guidance on how I might go about solving this problem? Afternoon, man about the Internet -- http:

Re: Automatic password creation

2005-12-01 Thread Afternoon
Great, thanks. On 1 Dec 2005, at 20:27, Wilson wrote: Here's the ticket you're looking for: http://code.djangoproject.com/ticket/61 Afternoon, man about the Internet -- http://aftnn.org/

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread oggie rob
An event system is a great idea! If we could tie it into AJAX there are some pretty amazing things that we could do. -rob

Re: Automatic password creation

2005-12-01 Thread Wilson
Here's the ticket you're looking for: http://code.djangoproject.com/ticket/61

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Patrick K. O'Brien
Robert Wittams wrote: > Amit Upadhyay wrote: > > > > I am confused as to what really do you mean by event system? > Most likely candidate is pydispatcher : > http://pydispatcher.sourceforge.net/ > > That'll get you the idea of the functionality, but the specific > implementation is a post 1.0 deba

Automatic password creation

2005-12-01 Thread Afternoon
Hi, After the move to SHA-1 there was a conversation on django-users about the admin interface not being able to generate passwords for new users. http://groups.google.com/group/django-users/browse_thread/thread/ 9fab7fbc34c1575/1dc5c952d8c094cf?rnum=1#1dc5c952d8c094cf Are there any pl

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Robert Wittams
Nebojša Đorđević - nesh wrote: > > On 2005-12-01, at 16:16 CET, Robert Wittams wrote: > >> >>> And for the current trunk, is there any way (other than changing >>> __init__.py) to me to hook-up with the model delete method? >> >> >> Not from a field really other than evil monkey patching tactics

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 16:16 CET, Robert Wittams wrote: And for the current trunk, is there any way (other than changing __init__.py) to me to hook-up with the model delete method? Not from a field really other than evil monkey patching tactics, IIRC. Because I don't want to keep a separate d

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 18:57 CET, Nebojša Đorđević - nesh wrote: OK, but can we make more thumbnails of different sizes from one image simultaneously? Thumbnails are generated on the first request from template (i.e ). You can pre- generate some sizes in model _post_save if you want. OTOH i

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 18:52 CET, Nebojša Đorđević - nesh wrote: Details follows I forgot. Just unpack .zip somewhere in your PYTHONPATH to use it. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 2821

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 18:20 CET, Radek Svarz wrote: OK, but can we make more thumbnails of different sizes from one image simultaneously? Thumbnails are generated on the first request from template (i.e src="{{ url|thumbnail:"width=100" }}" />). You can pre-generate some sizes in model _post_sa

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Radek Svarz
> thumbnails to make things more general. Thumbnails are saved in the > same directory as a original file with following filename pattern: OK, but can we make more thumbnails of different sizes from one image simultaneously? And can we add options for image decorations? (shadow, watermark, etc. t

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 17:52 CET, Radek Svarz wrote: I've realized that this is becoming quite a pattern. Would this correlate with your approach? Well, no. I deliberately choose not to have any predefined size for thumbnails to make things more general. Thumbnails are saved in the same direct

Re: Parser pranks

2005-12-01 Thread hugo
>My main question was, are these changes things that people are >interested in? I am. bye, Georg

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Radek Svarz
Hi, We have been using xt:Commerce for a while and I realized quite nice approach to organize images. There are several subfolders of media for product images, like follows: product_images/original_images product_images/thumbnail_images product_images/info_images product_images/popup_images wher

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Robert Wittams
Amit Upadhyay wrote: > On 12/1/05, Robert Wittams <[EMAIL PROTECTED]> wrote: > >> >>Nebojša Đorđević - nesh wrote: >> >>>IMHO some type of event system should definitely go in 1.0. Can we add >>>this to VersionOneFeatures? >> >>I wouldn't mind personally, but I think that at some point we have t

Parser pranks

2005-12-01 Thread Robert Wittams
So, I was messing around with the template parser a bit. I came up with this functionality: Stick: {%load valid%}{%assure well-formed%} ...blah blah xml... {%endassure%} Within the assure block, text is checked for well-formedness by running it through Expat. Parse errors are translated back

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 16:40 CET, PythonistL wrote: Please let know the Django community when you are finished with that. First version is attached to #961, it requires to patch django because that is the only way for me to add some "magic" into model delete method (see save/delete/etc hooks f

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread PythonistL
Please let know the Django community when you are finished with that. Any timeline? Regards, Lad.

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 16:16 CET, Robert Wittams wrote: And for the current trunk, is there any way (other than changing __init__.py) to me to hook-up with the model delete method? Not from a field really other than evil monkey patching tactics, IIRC. That's I'm afraid off ;) . So I must keep a

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Amit Upadhyay
On 12/1/05, Robert Wittams <[EMAIL PROTECTED]> wrote: Nebojša Đorđević - nesh wrote:>> IMHO some type of event system should definitely go in 1.0. Can we  add> this to VersionOneFeatures?I wouldn't mind personally, but I think that at some point we have to draw a moratorium on 1.0 features - and th

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Robert Wittams
Nebojša Đorđević - nesh wrote: > > IMHO some type of event system should definitely go in 1.0. Can we add > this to VersionOneFeatures? I wouldn't mind personally, but I think that at some point we have to draw a moratorium on 1.0 features - and that point has passed. 1.0 will not be the end of

i18n for JavaScript - Proposal

2005-12-01 Thread hugo
Hi, after thinking a bit more and reading the comments on the thread, I think I have a useful proposal for this stuff: - we define a view function that sends out a JavaScript file based on .mo/.po files. This view uses the same routines that are used by django itself. To build the message files,

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 14:12 CET, Robert Wittams wrote: I have a private branch here ( mutually-referential) that does a bit of this kind of stuff. It removes "most" of the dastardly special casing in meta/__init__.py . I will submit it as a ticket - it still has a few problems but it would be g

Re: Smarter cache

2005-12-01 Thread Robert Wittams
[EMAIL PROTECTED] wrote: > Hi, > > What about smarter cache system? I mean update not only by time-out, > but also by a DB change. > > In a news sites it will be especially usefull: content can update not > only each 'xxx' minutes, but it can also update by content > addition/edit/deletion. > >

Re: save/delete/etc hooks for custom fields

2005-12-01 Thread Robert Wittams
Nebojša Đorđević - nesh wrote: > > While I'm working on my custom ImageWithThumbnailsField I hit some > serious obstacles: > > 1. No chance to attach any information to model when field is created, > I added following (patch-like): > --- ../django/django/core/meta/__init__.py (revision 15

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Pedro Furtado
2005/12/1, Nebojša Đorđević - nesh <[EMAIL PROTECTED]>: And about thumbnails, well, I'm trying to automate this so you willjust need to ask for thumbnail of required size and it will be auto-magically generated for you (PIL is required), same with objectdeletion. Nice! Amazing how things are going

save/delete/etc hooks for custom fields

2005-12-01 Thread Nebojša Đorđević - nesh
While I'm working on my custom ImageWithThumbnailsField I hit some serious obstacles: 1. No chance to attach any information to model when field is created, I added following (patch-like): --- ../django/django/core/meta/__init__.py (revision 1522) +++ ../django/django/core/meta/__init

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
On 2005-12-01, at 11:24 CET, PythonistL wrote: Do you have a good experience with ImageField ? I will have to use images in my app. too but not sure about ImageField . I am thinking about having an extra integer field that has the same number as a picture. The picture will be stored separatel

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread PythonistL
Hi Nebojša, Do you have a good experience with ImageField ? I will have to use images in my app. too but not sure about ImageField . I am thinking about having an extra integer field that has the same number as a picture. The picture will be stored separately from the database and and also a thu

Re: Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
I'm forgot to mention that I'll make a new ImageThumbnailField (as a ImageField subclass) witch will implement all of the my proposals including all of the tags/filters required to make this work. This way I can experiment with thumbnail generation without disturbing main trunk. --- Neb

Re: Smarter cache

2005-12-01 Thread Nebojša Đorđević - nesh
On 1-12-2005, at 7:31, [EMAIL PROTECTED] wrote: So, are you interested in PHP realization with main idea explained? Yes --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.o

Add automatic thumbnail generation to ImageFields (from ticket #961)

2005-12-01 Thread Nebojša Đorđević - nesh
As discussed in http://code.djangoproject.com/ticket/961 and also referenced in http://code.djangoproject.com/ticket/674 and http:// code.djangoproject.com/ticket/425: Original proposal by [EMAIL PROTECTED]: There was some discussion about this in #425 and #674. Attached is a patch that