Re: Not calling things twice in templates
On Tuesday 04 June 2013, Daniele Procida wrote: > > [...] the {% with expensive.method as variable %} way of doing things > already exists, [...] What about my earlier suggestion that this be dealt > with in Python, not in templates [...] This thread, from its start, has mixed two separate (though related) issues. One of them is the performance cost of executing expensive computations more than once, which your arguments address (and IMO, you are right: invocations of nontrivial operations should be avoided in templates, and moved to Python code wherever possible). But I think that most suggestions focused more on the other issue: How to enable the only-do-pre-and-post-if-body-not-empty semantics with a succinct, clear syntax. Shai. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Meta-Proposal: Write *above* quotations in mailing list replies
Can we PLEASE not have this argument? It's literally as old as email itself, and totally futile. Drop it. Now. Jacob On Tue, Jun 4, 2013 at 2:33 PM, Wim Lewis wrote: > > On 4 Jun 2013, at 12:00 PM, Daniele Procida wrote: >> * quote what needs to be quoted for context >> * don't quote anything that doesn't need to be quoted > > This is, I think, the most useful/important point. There's no need to include > a whole string of previous messages in later ones; this isn't 1985, we all > have access to the rest of the thread if we want to go look. Trim the quotes > to what's immediately relevant or don't even include them. > >> * replies to particular points go immediately below quoted material > > This is certainly my preference, but as Michael Manfre says, I think it's not > something we need to be particularly uniform or strict about. I'd much rather > people put their effort into writing clearly than worrying about local > quoting customs. > > > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at http://groups.google.com/group/django-developers?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Meta-Proposal: Write *above* quotations in mailing list replies
On 4 Jun 2013, at 12:00 PM, Daniele Procida wrote: > * quote what needs to be quoted for context > * don't quote anything that doesn't need to be quoted This is, I think, the most useful/important point. There's no need to include a whole string of previous messages in later ones; this isn't 1985, we all have access to the rest of the thread if we want to go look. Trim the quotes to what's immediately relevant or don't even include them. > * replies to particular points go immediately below quoted material This is certainly my preference, but as Michael Manfre says, I think it's not something we need to be particularly uniform or strict about. I'd much rather people put their effort into writing clearly than worrying about local quoting customs. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Meta-Proposal: Write *above* quotations in mailing list replies
On Tue, Jun 4, 2013 at 1:14 PM, Yo-Yo Ma wrote: > Thoughts? > > I think we should all continue to write messages the way we deem best on an email by email basis. The content of the message is more important than whether we reply above or below and it's basically impossible for everyone to consistently adhere to the same style without enforcement. Trying to enforce guidelines would be more futile than trying to keep people from posting django-users questions here. Regards, Michael Manfre -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Meta-Proposal: Write *above* quotations in mailing list replies
On Tue, Jun 4, 2013, Yo-Yo Ma wrote: >If you're posting to this list by logging in to https://groups.google.com/ >rather than via email, I'd like to propose that you write your reply above >the quoted message to which you're replying. I think that would be a bad idea. >The way it stands now, about half >of the messages that I can see (without clicking to the Google Groups >website) are just: > >> So and So said: >>> This that the other >>> and the other That looks as though other people have been doing upside-down quoting too, but I'm not sure because I'm not sure what the digest does. >Thoughts? I propose the opposite: * quote what needs to be quoted for context * don't quote anything that doesn't need to be quoted * replies to particular points go immediately below quoted material This makes it easier to read and follow a thread, and is a far more comfortable way to understand who is saying what, and in reply to whom. Daniele -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Username Independence in Auth Forms
Really what you are proposing is an extension of the scope #19353, and I do feel that if the built in forms are to be made more usable with custom users, then both the hardcoding of auth.User and the username field should be addressed together. One thing not addressed in your authtools approach that is done in the current RegexField of the builtin form is handling regex validation of valid usernames - if your custom user requires some other sort of validation, you have to hook up some sort of custom validator like you've done, which seems like more work than just creating a custom form where you can define the fields as you need them. Also you may not need or want all REQUIRED_FIELDS in your form - this is a somewhat unfortunate label for this property - as it is really more specific to the management command prompts (ie, you can specify a field as required in the model, but not include it in that list, or vs versa). A good step here might be a little DDD, write the docs to cover the cases where you may need to work around this proposed flexible approach - if it seems like it gets too complicated to explain, perhaps just leaving it documented as requiring the author to create new forms (which is more work, but maybe more straightforward) - may still be the best choice. If this can be done in a way that maximizes win, I'm all for it, but if it is trading less work in some cases, for more in others, I'm less sure. -Preston On Monday, June 3, 2013 11:48:40 AM UTC-7, Gavin Wahl wrote: > > > The current code assumes that if you write a custom model, you'll also > write the corresponding custom forms. > > Right. This is what I am proposing be fixed. > > > On Mon, Jun 3, 2013 at 12:31 PM, Aymeric Augustin < > aymeric@polytechnique.org > wrote: > >> On 3 juin 2013, at 20:01, gavi...@gmail.com wrote: >> >> > Some of the built-in auth forms only work on user models whose >> `USERNAME_FIELD` is `username`. >> >> Hi Gavin, >> >> The current code assumes that if you write a custom model, you'll also >> write the corresponding custom forms. >> >> You may want to have a look at >> https://code.djangoproject.com/ticket/19353 which describes the same >> problem (as far as I can tell). >> >> -- >> Aymeric. >> >> >> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Django developers" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/django-developers/XxaZ50SxPj4/unsubscribe?hl=en >> . >> To unsubscribe from this group and all its topics, send an email to >> django-develop...@googlegroups.com . >> To post to this group, send email to >> django-d...@googlegroups.com >> . >> Visit this group at >> http://groups.google.com/group/django-developers?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Meta-Proposal: Write *above* quotations in mailing list replies
Certainly, when a user is replying to portions of a quoted text separately (as Russel often does) it is helpful to break up the quoted text into actionable sections and reply below each. However, when a user is simply clicking the "Post Reply" button, chances are, it's going to be easier to read as: Post 1 Post 2 >> noise Post 3 >> noise Rather than as: Post 1 >>Post 1 Post 2 >> Post 1 >> Post 2 Post 3 >> Post 1 >> Post 2 >> Post 3 Post 4 >> Post 1 >> Post 2 >> Post 3 >> Post 4 Post 5 Also to reiterate, in email digests the latter format results in the reply not even being included in the email. Since this is a mailing list, it's sometimes useful to be able to actually read a digest of it it in your email. Cheers Yo-Yo On Tuesday, June 4, 2013 1:28:47 PM UTC-4, Javier Guerra wrote: > > On Tue, Jun 4, 2013 at 5:14 PM, Yo-Yo Ma > > wrote: > > Thoughts? > > > A: Because it messes up the order in which people normally read text. > Q: Why is top-posting such a bad thing? > A: Top-posting. > Q: What is the most annoying thing in e-mail? > > > > -- > Javier > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Meta-Proposal: Write *above* quotations in mailing list replies
On Tue, Jun 4, 2013 at 5:14 PM, Yo-Yo Ma wrote: > Thoughts? A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? -- Javier -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Meta-Proposal: Write *above* quotations in mailing list replies
I think I just posted a quick reply and I wasn't sure whether to quote above or below, but from now on I'll be glad to post in the way that provides easier readability for everyone. For long proposals, I'll keep replying below quotes for exactly the same reason. On Tue, Jun 4, 2013 at 2:18 PM, Donald Stufft wrote: > I think trying to get anyone to change their posting habit is a futile > effort. Cheers, AT -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Meta-Proposal: Write *above* quotations in mailing list replies
On Jun 4, 2013, at 1:14 PM, Yo-Yo Ma wrote: > If you're posting to this list by logging in to https://groups.google.com/ > rather than via email, I'd like to propose that you write your reply above > the quoted message to which you're replying. If you do this, the digest > emails that most subscribers get will be easily previewable from their email > client (e.g., iPhone's Mail app). The way it stands now, about half of the > messages that I can see (without clicking to the Google Groups website) are > just: > > > So and So said: > >> This that the other > >> and the other > > > So and So said: > >> This that the other > >> and the other > > Thoughts? > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at http://groups.google.com/group/django-developers?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > I think trying to get anyone to change their posting habit is a futile effort. - Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA signature.asc Description: Message signed with OpenPGP using GPGMail
Meta-Proposal: Write *above* quotations in mailing list replies
If you're posting to this list by logging in to https://groups.google.com/ rather than via email, I'd like to propose that you write your reply above the quoted message to which you're replying. If you do this, the digest emails that most subscribers get will be easily previewable from their email client (e.g., iPhone's Mail app). The way it stands now, about half of the messages that I can see (without clicking to the Google Groups website) are just: > So and So said: >> This that the other >> and the other > So and So said: >> This that the other >> and the other Thoughts? -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Not calling things twice in templates
On Tue, Jun 4, 2013, Andre Terra wrote: >I'm mostly concerned with ambiguous behaviour for the clauses which include >other operands. For example, Looking at the various solutions that have been proposed, I am not at all sure that this is something that the template author should have to deal with at all. Most of the suggested avenues seem to make the template-writing more complex, and the templates more full of important decisions about whether they want their code to touch the database in expensive ways, which is surely asking more of the template design process than is appropriate. Also, the {% with expensive.method as variable %} way of doing things already exists, and doesn't seem more complex than the suggested alternatives. What about my earlier suggestion that this be dealt with in Python, not in templates - that the Python programmer decides, for a particular method (or class, because I guess a class could have an expensive __init__()) whether that thing should be re-evaluated more than once per request, or per context? Daniele -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Not calling things twice in templates
On Mon, Jun 3, 2013 at 7:03 PM, Shai Berger wrote: > > {% with my_bonnet.bees as bees if my_bonnet.bees %} > > {% if my_bonnet.bees with my_bonnet.bees as bees %} > > The only problem I see with these is the repetition -- we could just allow > "as" on {% if %}: > > {% if my_bonnet.bees as bees %} > I'm mostly concerned with ambiguous behaviour for the clauses which include other operands. For example, {% if user in blacklisted_users as result %}{# should result be user, blacklisted_users or True/False? #} It could be argued that by having a different behavior for the simple case such as the original example could lead to confusion. Special cases aren't special enough to break the rules. Cheers, AT -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Make sure QuerySet.get() does not fetch more rows than it absolutely needs
I'd be inclined to agree with Anssi that we could do something like LIMIT 21 to just remove the issues with large numbers. I have found it quite helpful to have the exact number when it's small - especially when debugging issues with strange joins etc. On 4 June 2013 15:02, Jacob Kaplan-Moss wrote: > On Tue, Jun 4, 2013 at 1:48 AM, Anssi Kääriäinen > wrote: > > As for .get() - I don't find the number of duplicates in the error > > message that useful. > > Yeah, I'd agree with that. It's another one of those things that goes > WAY back into the misty reaches of Django's history, but I don't think > there's a particularly good reason it's stuck around. I think a LIMIT > 2 and an error message like "… returned more than one" would be fine. > If people are particularly interested, they could re-run the query > with a .count() instead of a .get(). > > Jacob > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at http://groups.google.com/group/django-developers?hl=en > . > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Make sure QuerySet.get() does not fetch more rows than it absolutely needs
On Tue, Jun 4, 2013 at 1:48 AM, Anssi Kääriäinen wrote: > As for .get() - I don't find the number of duplicates in the error > message that useful. Yeah, I'd agree with that. It's another one of those things that goes WAY back into the misty reaches of Django's history, but I don't think there's a particularly good reason it's stuck around. I think a LIMIT 2 and an error message like "… returned more than one" would be fine. If people are particularly interested, they could re-run the query with a .count() instead of a .get(). Jacob -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.