{% url app_views.client %}
{% "url app_views.client" %}
Did you read the rationale for this change? How do you want to enable
passing context variables as view names? Did you notice that almost
everywhere in the template language literal strings are quoted?
Technical arguments usualy work better then calling things "stupid".
--
Łukasz Rekucki
Docs and Django 1.3 release notes:
https://docs.djangoproject.com/en/dev/releases/1.3/#changes-to-url-and-ssi
>
> and btw. is there repo for developing 1.5 with python3 support?
>
AFAIK, not yet. There's a features/py3k branch, but I'm not sure if
it's up to date with Tarek's bitbucket repo. My bet is that py3k merge
will happen after the GitHub migration which everyone seems to be busy
with ;)
--
Łukasz Rekucki
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/-kXfyDKv3-MJ.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Please post references from where did you get this nonsense. It is
completely wrong to the point of not even being correct syntax.
Please read the oficial documentation.
--
Ramiro Morales
On Mar 27, 2012 8:45 AM, "Ramiro Morales" <cra...@gmail.com> wrote:
>
> On Tue, Mar 27, 2012 at 5:22 AM, gs412 <gs...@126.com> wrote:
> > In Django1.5
> >
> >> {% url app_views.client %}
> >
> > will change to
> >>
> >> {% "url app_views.client" %}
> >
>
> Please post references from where did you get this nonsense. It is
> completely wrong to the point of not even being correct syntax.
>
> Please read the oficial documentation.
>
> --
> Ramiro Morales
It's actually almost correct. The new syntax will actually be
{% url "app_views.client" %}
But this change definitely doesn't make things "dirty," in fact it cleans up the tag to have consistent syntax with nearly every other tag, such as {% block %} and {% extends %}
Best,
Alex Ogier
This isn't my best day. First I don't notice the quotes in the example
are misplaced, then I mix up Tarek Ziade with Vinay Sajip. Of course I
meant this repo: https://bitbucket.org/vinay.sajip/django ; Sorry for
the confusion :(
---
Łukasz Rekucki
{% with url_name="client-detail-view" %}
{% url url_name client.id %}
{% endwith %}
On Mar 27, 2012 3:26 PM, "gs412" <gs...@126.com> wrote:
>
> Less symbol is the tide, the future. for example: coffeescript、sass、haml、slim and python, there are all less symbol, this feature make developer fell well
>
> passing context variables for tag "url" is not a good idea, it make the work from easy to hard
>>
>> {% with url_name="client-detail-view" %}
>> {% url url_name client.id %}
>> {% endwith %}
>
>
> three lines instead of one lines, just for passing context variables, context variables for url is not widespread
>
Well yes, it's not widespread: It's currently impossible. And it's only three lines if you want to explicitly create a context variable inside a template (which you will note is done with a quoted string constant). What your example demonstrates is how to create a constant variable that is used immediately... why would you ever do that?
Alex Ogier
Less symbol is the tide, the future. for example: coffeescript、sass、haml、slim and python, there are all less symbol, this feature make developer fell wellpassing context variables for tag "url" is not a good idea, it make the work from easy to hard{% with url_name="client-detail-view" %}
{% url url_name client.id %}
{% endwith %}
three lines instead of one lines, just for passing context variables, context variables for url is not widespread
在 2012年3月27日星期二UTC+8下午8时38分04秒,Łukasz Rekucki写道:On 27 March 2012 10:22, gs412 <> wrote:
> In Django1.5
>
>> {% url app_views.client %}
>
> will change to
>>
>> {% "url app_views.client" %}
>
>
> I think it is a stupid ideaDid you read the rationale for this change? How do you want to enable
passing context variables as view names? Did you notice that almost
everywhere in the template language literal strings are quoted?
Technical arguments usualy work better then calling things "stupid".
--
Łukasz Rekucki
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/kADHFAbppUwJ.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
This is incorrect. If Python were all about "fewer symbols", then we
would favor tabs over spaces, we would not require colons at the ends
of block-starting lines, and we would have operators like "!" instead
of "not".
One of the goals of Python is to be *more readable*, not to be
unnecessarily terse.
> passing context variables for tag "url" is not a good idea, it make the work
> from easy to hard
>>
>> {% with url_name="client-detail-view" %}
>> {% url url_name client.id %}
>> {% endwith %}
>
>
> three lines instead of one lines, just for passing context variables,
> context variables for url is not widespread
You don't need three lines. There is no reason that the following
shouldn't work, so if it doesn't, then that is something that ought to
be fixed.
{% url "client-detail-view" client.id %}
This syntax has been available since Django 1.3, which was released a
year ago. If Django 1.5 takes the same amount of time that 1.4 did,
then it is still another year away. That is two full years to bring
your templates up-to-date, and it is a simple enough change that you
could probably do it with a short script.
Cheers,
Ian
It should also be added that since Django 1.3, you've been able to put {% load url from future %} at the top of your templates, which allows you to cleanly introduce the use of the new tag into your templates. This was also documented in the release notes for Django 1.3.
To the original poster -- thanks for the suggestion, but no, this isn't going to be reverted.
Ironically, your "3 line" example points out exactly why the change has been made -- it allows you to use a variable to be used as your URL name, whereas the unquoted behavior requires that your url is a known, static string. Without the new behavior of the URL tag, you wouldn't be able to use the URL tag with a value set in a with tag.
Yours,
Russ Magee %-)