Request for eyes familiar with ORM internals and defer/only (attn: Malcolm)

2011-10-20 Thread Tai Lee
I've run into a bug that is exposed when using defer() or only() with select_related(). A couple others have come across it, and there is an existing ticket. Exceptions appear to be silenced somewhere under normal circumstances when evaluating `queryset` objects, which made it difficult to track d

Re: Ability to specify a skeleton project

2008-05-30 Thread Tai Lee
The easy way (and what I do now) is create your "skel" folder in SVN (or whatever you use), then just do an svn copy for new projects and away you go. That way you can also store common svn:externals or svn:ignore properties in your directory structure as well. On May 29, 12:12 am, phillc <[EMAI

Re: Django releases

2008-06-09 Thread Tai Lee
Personally I loosely follow trunk so I'm not waiting for 1.0, and I don't really care how many "releases" there are between now and 1.0. What I would like to see is the last few major NFA blockers fixed and NFA merged into trunk. Just get it out there in trunk, so we can get more real world use re

Re: Django 1.0 roadmap

2008-06-17 Thread Tai Lee
There are a few open tickets that I'm aware of (4412, 4604) which are either ready for checkin or are waiting for NFA to hit trunk before moving to ready for checkin. The work is done (patch, docs, tests). Should these be included in the 1.0-beta or 1.0 milestone? --~--~-~--~~---

Re: Support for ON DELETE and ON UPDATE in foreign keys

2008-06-20 Thread Tai Lee
I've implemented some code already to de-reference (SET_NULL) on delete, in a view which first presents a list of objects which will be deleted and a list of objects which will be de-referenced. It might not be the most efficient approach, but it could be a starting point. def _clear(instance):

Re: Simple_tag revamp: now takes context and inner block #1105

2008-06-22 Thread Tai Lee
I like it. I've run into a few cases recently where I just needed a simple_tag with access to the context. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email

Call for comments: CommonMiddleware (and others) break streaming HttpResponse objects.

2008-07-01 Thread Tai Lee
http://code.djangoproject.com/ticket/7581 Just posted this ticket with an initial patch (sans documentation changes and tests). Basically there are several middleware classes that access HttpResponse.content directly which break streaming HttpResponse objects that use a generator to yield content

Re: Call for comments: CommonMiddleware (and others) break streaming HttpResponse objects.

2008-07-01 Thread Tai Lee
Certainly the implementation of the patch is not ideal (by accessing private attributes on HttpResponse), which is why I brought it up for discussion before going any further. I do feel that there is a real benefit and even requirement in some cases to supporting streaming HttpResponse objects. I

Re: Call for comments: CommonMiddleware (and others) break streaming HttpResponse objects.

2008-07-01 Thread Tai Lee
On Jul 1, 7:15 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > It's quite a large restriction to say that no middleware should ever try > to examine the contents of the HttpResponse since it might be an > iterator that shouldn't be consumed. You're proposing a bunch of > specific changes for

Re: Call for comments: CommonMiddleware (and others) break streaming HttpResponse objects.

2008-07-03 Thread Tai Lee
> The only thing that might be worth doing in this are is adding a way to > say "middleware should never be called on this response" and then > somebody can write their own HttpResponse subclass and be in complete > control of their destiny. Would this disable ALL middleware from running? Or only

Re: QueryDict.iteritems behaves differently than QueryDict.items

2008-07-04 Thread Tai Lee
1.0 should ideally ship with Zarro Boogs, so any bugs (not DDN) especially trivial ones with a patch including relavent tests / docs should be marked for 1.0 milestone, I think ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go

Re: Make clickable area of object links larger

2008-07-12 Thread Tai Lee
Even better, make the entire row the link (like trac). I don't see why only the value of the first field should be the link. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this

Re: Make clickable area of object links larger

2008-07-13 Thread Tai Lee
Isn't click to focus a window (or not) an OS decision? E.g. clicking anywhere in a browser window on a Mac will focus the window but not send a click to the application. Even if that weren't the case, making the link area smaller just reduces the probability for accidental clicks and makes it mor

Re: Make clickable area of object links larger

2008-07-14 Thread Tai Lee
> If I'm not mistaken, in NFA, you can create a custom subclass of > ModelAdmin that always sets list_display_links equal to list_display, > and have all of your models inherit from that.  This is the most > flexible solution because people who don't want it to default to > clickable get their way

Re: Generic relations and non-integer primary keys

2008-07-17 Thread Tai Lee
A documentation change about using a different field type is not enough in some cases (PostgreSQL 8.3), as noted in #6523 [1]. PostgreSQL 8.3 won't implicitly cast variables anymore, so if you pick integer for your generic relation you'll have problems relating models with varchar, and vice versa.

discussion: can't iterate over lines in `UploadedFile` with `\r\n` or `\r` line endings

2008-08-28 Thread Tai Lee
http://code.djangoproject.com/ticket/8149 As mentioned in the ticket, `UploadedFile.__iter__` iterates over a `StringIO` object to yield each line of the uploaded file (including line endings). Unfortunately the current version of `StringIO` only treats `\n` as a line ending, but iterating over a

Re: Forms and edition of an object : non-pythonic default behaviour

2008-09-07 Thread Tai Lee
In your hypothetical, how would you handle boolean fields with a checkbox widget? When they are unticked, they are not included in the QueryDict. It could get confusing if we start special casing fields like these in order to support "no data" as a different case to "empty data", just to avoid hav

Proposal: `create_or_update` method on query sets, managers, and related managers.

2008-09-10 Thread Tai Lee
On a few occasions I've found myself doing something like: instance, created = Model.objects.get_or_create(something=something, ..., defaults={ 'somethingelse': somethingelse, ... }) if not created: instance. somethingelse = somethingelse ... instance.save() I'd like to propo

Re: Special case: DateTimeField and SplitDateTimeWidget

2008-09-16 Thread Tai Lee
I've just had another thought. With `SplitDateTimeWidget` validation coupled to `DateTimeField`, it's no longer easy to subclass `DateTimeField` for use with your own `MultiValueWidget`. When you call `super` for the DateTimeField validation, it will run `DateTimeField.clean` which will return an

Re: Call for comments: CommonMiddleware (and others) break streaming HttpResponse objects.

2008-09-22 Thread Tai Lee
On Sep 23, 3:54 am, mrts <[EMAIL PROTECTED]> wrote: > +1 for adding a way to say "process_response should never be called on > this response". > > Taking a quick look at the source, HttpResponse seems to support > iteration already: > >     def __iter__(self): >         self._iterator = iter(self.

Re: Proposal: django.forms.SafeForm - forms with built in CSRF protection

2008-09-22 Thread Tai Lee
On Sep 23, 9:27 am, Simon Willison <[EMAIL PROTECTED]> wrote: > The significant downside is that having a render() method on a form > that performs the same function as render_to_response feels really, > really strange. It's convenient, but it just doesn't feel right and > I'm not sure I can justi

Iteration over lines in uploaded files only supports `\n` line endings.

2008-09-24 Thread Tai Lee
In #8149 [1] I reported that `UploadedFile` uses `StringIO` to iterate through uploaded files line-by-line, but `StringIO` only treats `\n` as a line ending, at least in the current version. This effectively means we can't use line-by-line iteration over uploaded files because we don't know what

Simple bug fix for DateTimeField with SplitDateTimeWidget.

2008-10-14 Thread Tai Lee
#8898 is a simple bug fix with tests for DateTime fields with required=False, which currently fail to validate in the admin because the `required` validation is being bypassed when using SplitDateTimeWidget with DateTimeField (which seems questionable to begin with). I'd set it to ready for check

Re: Proposal: Signal after model of app was loaded

2008-10-22 Thread Tai Lee
I'd love to see this feature implemented. I was previously (mistakenly) using `management.py` in my app folders for this, thinking that it was imported when any management command was executed (such as `runfcgi`, `runserver`, `shell`, etc). Unfortunately it's only imported when `syncdb` is execute

Re: Proposal: Manage.py custom commands overloading

2008-10-31 Thread Tai Lee
If it feels wrong to put a command in "project/app1", you can put it in "project" and simply add "project" to your INSTALLED_APPS. You can then place any models, management commands, URLs, views, or anything else that is common to all your "apps" in the "project" app. --~--~-~--~~---

Re: 1.0.1 release blockers?

2008-11-01 Thread Tai Lee
On Nov 1, 1:38 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > > Really, there is not reluctance to get input on what should be fixed before > 1.0.1 is released.  It's just that input in the form of working patches with > tests and doc is far more valuable than a simple bit on a ticket.  The list

Re: 1.0.1 release blockers?

2008-11-02 Thread Tai Lee
Thanks for your feedback, Karen. > http://code.djangoproject.com/ticket/8898 > > I suspect this one may be stalled because it is in design decision needed > state with a last comment that makes it sound like the existing patch (added > before the last comment) is not correct and that the right fi

Re: 1.0.1 release blockers?

2008-11-02 Thread Tai Lee
On Nov 2, 10:57 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > > You do know that Karen has a commit bit, right? If she's got concerns > about a ticket, then I at least take that as meaning it's got problems > and isn't ready for checkin. Yes, I did notice that. However, as I said, there is sti

Re: Ticket 8638: Provide setting to disable e-mail sending

2008-11-28 Thread Tai Lee
I currently use my own versions of `send_mail` and `mail_*`, which hijack the recipients if DEBUG is True. The idea being that I don't want to send real emails to real recipients while developing, debugging and testing. In this case I get real emails delivered to everyone listed in `settings.ADMI

test failures when CACHE_BACKEND is 'dummy:///'

2008-12-17 Thread Tai Lee
Specifically, in `django.contrib.sessions.tests`: > ..F. > == > FAIL: Doctest: django.contrib.sessions.tests > -- > Traceback (most recent call last)

Re: Additional Fields in Core

2008-12-17 Thread Tai Lee
I've used and would like to see at least JSONField and/or PickleField in contrib/core. Here's a link to my current implementation. http://dpaste.com/hold/100270/ If it's not going to make it into contrib/core, I'd welcome any suggestions, improvements or alternative implementations. Cheers. Tai

Re: Some tickets that should perhaps get looked at before 1.1

2009-01-07 Thread Tai Lee
I'd also love to see 8898 committed. It looks to be a fairly straight- forward bug fix, at least to me. http://code.djangoproject.com/ticket/8898 Cheers. Tai. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Trivial tickets languishing with unreviewed status.

2009-02-05 Thread Tai Lee
I'd like to bring attention to several tickets that have been sitting unreviewed for 3-5 months. Most are fairly trivial fixes for bugs and inconsistencies. Most have a patch and/or tests. I believe that all are backwards compatible. I'd really appreciate feedback from any core developers, or anot

Ready for checkin / review (for 1.1): [ORM-09] Manager.update_or_create() and Model.update().

2009-02-17 Thread Tai Lee
One of the desired but lacking a champion features for 1.1 ([ORM-09], #3182) has been updated to work with r9844 with tests and docs, and improved as per the last comments on the ticket. I think this one is ready to go in, but I didn't want to set the ticket "ready for checkin" until someone else

Re: 'week_day' starting with sunday as first day of a week need to be fixed

2009-03-07 Thread Tai Lee
In my bike shed (and cron's), Sunday is 0 AND 7, which seems nice. Then your week can starting with Sunday as 0-6 or Monday as 1-7. Oh, I see that Bob Thomas already suggested this. Isn't it a moot point, though? Isn't it considered a backwards incompatible change even if made before 1.1? Or is

Re: #3182 -- model instance update() method and QuerySet update_or_create() method

2009-03-15 Thread Tai Lee
> I'm very unconvinced that the idea in the ticket is worth it. It's a > two-liner if somebody wants to do this in their code, so whilst we *can* > add this method, adding yet another thing to Model namespace that also > adds to the documentation and things that need to be tested, etc, > doesn't s

[9760] "ModelAdmin.formfield_for_dbfield re-factor" changes behaviour.

2009-03-15 Thread Tai Lee
The re-factored code moves the definition of default widgets for each model field into an update-able dict and uses `if dbfield.__class__ in self.formfield_overrides` to look up the correct widget for `dbfield` instead of using `isinstance()`. The problem arises when using a custom model field th

Re: #3182 -- model instance update() method and QuerySet update_or_create() method

2009-03-23 Thread Tai Lee
Are the objections being raised for `update()` equally applicable to `update_or_create()`? I would have thought that a name-space clash for this method on the objects manager would have been a non-issue, as would any confusion about the use of `force_update` and `force_create` internally (as they

Re: BigInt Patch for Django 1.0.2

2009-04-13 Thread Tai Lee
You could even put such an `ALTER TABLE` statement in a `sql/ modelname.sql` file to be executed as initial SQL data as soon as the table is created by `syncdb`. On Apr 8, 11:40 pm, Thomas Guettler wrote: > Hi, > > I once get BigInt working by a little "ALTER TABLE ... ALTER COLUMN" > statemen

Please reverse [10456] (use NullBooleanField instead of BooleanField(null=True)), it doesn't make sense.

2009-05-07 Thread Tai Lee
I just noticed in recent versions of Django that BooleanField (null=True) will raise a validation warning, indicating that I should use NullBooleanField instead. This doesn't make sense, and is mixing up the definition of a model field in SQL and the behaviour of a model field in Django. BooleanF

Automatically get default value for "current_app", for easier namespace support.

2014-05-20 Thread Tai Lee
Right now it seems that for a generic app to support the possibility of being installed in a URLconf with a namespace, the app author will need to take care to explicitly define a `current_app` for every call to `reverse()`, `TemplateResponse`, `RequestContext`, `Context` and `{% url %}`. Djan

Re: Don't assume that missing fields from POST data are equal to an empty string value.

2018-01-23 Thread Tai Lee
>From my perspective, this issue is about silent data loss, which is about one of the worst bugs you can have and one that Django typically tries very hard to avoid or fix, even if it breaks compatibility. It is extremely easy to cause silent data loss with the behaviour being discussed. For whate

Re: Allowing multiple {% block %}s in one template

2007-06-08 Thread Tai Lee
I'm -0 on this too, even though I have run into a situation where I wanted a block to appear twice in a base template, and the content of the block was defined in the view template (can't remember the details). The additional complication and strange rules are not worth the benefit (and I'm not ev

Re: PhoneNumberField

2007-06-13 Thread Tai Lee
i'd like to see a single generic phone number field, and different methods attached to it that format it to the required formats. usa, international, including or excluding country code, using spaces or dashes, with or without leading zeroes, etc. --~--~-~--~~~---~--~

Re: signals

2007-06-13 Thread Tai Lee
I use Any sender a fair bit (in a generic version control app), and I'd not like to see that disappear without considerable performance penalties if keeping it / considerable performance gains if removing it. --~--~-~--~~~---~--~~ You received this message because

Re: International standard for date and time

2007-06-17 Thread Tai Lee
+1 - it's a simple default settings change. django is used by an international community, so the defaults should be a format that is understood by everybody without any possibility of ambiguity. those that prefer a different format (american, or abbreviated or full length month names etc) can chan

Re: BooleanField and NullBooleanField (#2855 again)

2007-06-26 Thread Tai Lee
I would have thought it's obvious. Any fields are are not null=True must have a default specified in the model or a value explicitly provided before calling save(). However, I just did a quick double- take and it looks like CharField actually has an implicit default of "" already. If CharField can

Re: Documentation should never show non-working examples. - was: "@cache_page" bug...

2007-07-05 Thread Tai Lee
imo, the official documentation should not document bugs, and should also not provide non-working examples. therefore either the bug should be fixed immediately, or the example should be removed immediately (to be re-instated when the bug is fixed). it is true that many bugs remain in trunk for a

Re: Small concern in newforms-admin

2007-07-07 Thread Tai Lee
indeed, many people prefer to login with their email address, or use their email address as their username. that way they're not likely to forget it, and can use the same one which is guaranteed not to be in use by anyone else across all their sites. rather than having to remember multiple usernam

Re: please help! need to know python version

2007-07-07 Thread Tai Lee
as long as django doesn't *require* a version of python that is not on your approved list and therefore cannot run, you shouldn't have any problems. django is built to work on python 2.3, just because it is also compatible with 2.4 and 2.5 shouldn't mean anything. the fact that the code still work

Re: Session based Messages

2007-07-09 Thread Tai Lee
I've been using my own messages in sessions for a while now and every message i send is either "good", "bad", or neutral (neither good nor bad). these three states are very generic and cover every type of message i need to send. at present i display good messages in green, bad in red, and neutral

Re: Default application layout, project/app distinction and encouraging best practices

2007-07-09 Thread Tai Lee
For each new site I work on I have a root folder which contains a copy of Django, other 3rd party libs I need, and a Django project for my site. I do this so I can upgrade or customise Django for each site individually without breaking other sites. I'll probably switch back to a common Django afte

Re: Proposal: QuerySet.exists() method

2007-07-15 Thread Tai Lee
I'm also +1 __nonezero__ -1 .exists(). Using .count() already gives us the required functionality and makes logical sense, the only question then is how big of a performance gain do we get by using SELECT 1 LIMIT 1. SELECT 1 FROM [table] LIMIT 1 also feels kinda hackish to me, and I'm guessing it

Re: None != Null?

2007-07-18 Thread Tai Lee
I think that instead of executing queries where you want to return no records and know that no records will ever be returned if a field lookup is None (e.g. in the case of related objects to an unsaved object), you should just catch that condition and not execute that query. In 9 years I've never

Re: include tag security hole

2007-07-22 Thread Tai Lee
On Jul 22, 8:29 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > I'm personally ambivalent about where the "include" tag should be able > to search, because I can see cases where it'd be useful to have it > pull in things that aren't in TEMPLATE_DIRS. If you're interested in > confining the place

Re: Best Practices to Make your Apps Portable

2007-07-28 Thread Tai Lee
Why do you need a shared project to house generic apps? Why not just put them at dango_root (or anywhere on your python path), and install them in your django projects (sites)? django_root/ genericapp1/ genericapp2/ mysite/ __init__.py apps/ __init__.py

Re: Autoescaping: good time?

2007-08-02 Thread Tai Lee
+1 for autoescape on by default, switched off with a tag in base templates, applied to all templates regardless of extension. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to thi

Re: Proposal: runserver --with-fixture

2007-08-14 Thread Tai Lee
if re-serializing the data when closing the dev server, wouldn't it be easier to just leave it in the db and not trash/recreate the db all the time, and manually dump/load the serialized data when necessary? --~--~-~--~~~---~--~~ You received this message because

Re: Admin and Related Models/Fields

2007-08-25 Thread Tai Lee
I'd be +1 in allowing list_display options in the form of 'model__field' ('model__model__field', ...), and I have found myself wanting this on several occasions. Yes it is possible to create a method and call it as a column in the results, but I think the intention with that was more for calculat

Re: Multiple PKs and "is_stored"

2007-08-31 Thread Tai Lee
> If there are any, then I would expect it'd handle them just as it does > without the flag. The problem is (at least in my eyes) that Django > should not be guessing, and especially should not be doing an extra > query, when you are explicitly saing update or create on an object. Django *would*

Re: Max. size of User.email is 75 chars

2007-08-31 Thread Tai Lee
It should probably be 320, and if there are any databases that don't support a field that long, it should be reduced to accomodate those databases (only), rather than holding everything back for the lowest common denominator? --~--~-~--~~~---~--~~ You received thi

Re: #4412 -- Optgroups in newforms select widgets

2007-09-02 Thread Tai Lee
Isn't having choices (with a value and display text) already combining presentation with the model? I don't see why having the model ignore the groupings would be any worse than having the model ignore the display text for each choice. I'd really like to see nested choices / optgroups allowed in

Re: Many-to-many relationships with additional columns

2007-09-11 Thread Tai Lee
I think I'd like to see this functionality in trunk, too. Previously when I needed a M2M model with sequence or other data, I just created the M2M model explicitly with ForeignKey fields to the two related models. class Role(models.Model): role = models.CharField(maxlength=255) c

Re: Possible bug in Meta ordering in 0.96

2007-10-03 Thread Tai Lee
I've implemented multi-column ordering in my own projects, and don't think it's that tricky to use (in the UI, implementation may be tricky but not too tricky). I use multi-column ordering all the time in my apps and most desktop apps, so I'd love to see it built into the Django admin. In terms o

Re: how practically to extend your models?

2007-10-11 Thread Tai Lee
ForeignKey with unique=True does work and is the same at the SQL level, but OneToOneField does have a couple of niceties attached to it like adding the related object as an attribute to the model containing the OneToOneField. If those could be re-added to ForeignKey fields with unique=True, that w

Re: ForeignKey(unique=True) and ForeignRelatedObjectsDescriptor

2007-11-06 Thread Tai Lee
I had previously used OneToOne relationships and liked the auto mapping they did, as in the OP's example. I was told that OneToOne didn't work in some cases and was going away, and that I should use ForeignKey(unique=True) instead. If there are technical problems with OneToOne and ForeignKey(uniq

Re: lazy (in utils.functional) is broken

2007-12-18 Thread Tai Lee
I think I was just bitten by this. The model fields defined in django.contrib.auth.models (and I assume other parts of django) use django.utils.translation.ugettext_lazy to specify the label (or another property from which the label is derired). The form field objects generated by form_for_* and M

Re: lazy (in utils.functional) is broken

2007-12-23 Thread Tai Lee
Ticket opened. http://code.djangoproject.com/ticket/6272 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscr

Re: Undocumented admin feature for filtering rows?

2008-01-08 Thread Tai Lee
+1 interested party ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to

Re: API question for model saving

2008-05-01 Thread Tai Lee
I'd vote for create() and update() methods which seem the least confusing, but that doesn't seem very popular. If it has to be done with arguments on save(), I'd say force_create=False, force_update=False is the easiest to read and understand. I'd prefer either of those options over a null/true/f

Re: Model Inheritance in qsrf and User?

2008-05-01 Thread Tai Lee
> Purely in terms of OO design, because it's cleaner.  Object > composition is usually a more appropriate paradigm than class > inheritance.  To take the example from the post that started this > thread, the relationship between users and user profiles is "has-a", > not "is-a".  So what would be t

<    1   2