Feature Request: Replacing default template system by a more powerful one: Jinja2

2018-01-26 Thread Ander Ustarroz
I have been working a lot with Django and I have always asked myself how is 
it possible that they decided to use Django Template system rather than 
Jinja2 , when it is way more 
intuitive, just like writing natural Python! Someone may argue that  it's 
matter of taste but I bet they haven't tried both template systems.

Yeah I know... we can still use Jinja2 if we want to, but shouldn't it be 
the native choice when is obviously the best?

Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/566bd276-110c-4374-bd1e-ed5afbceb839%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Error

2018-01-26 Thread 'Anoosha Masood Keen' via Django developers (Contributions to Django itself)

*Help with error:*


AttributeError: 'NoneType' object has no attribute 'startswith'


*Code added to settings.py:*
MIGRATION_MODULES = {}
for app in INSTALLED_APPS:
if app:
#print (app)
MIGRATION_MODULES[app] = None
print (MIGRATION_MODULES[app])
  

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/c5ea18ce-4b58-426e-9793-ea7396c44685%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error

2018-01-26 Thread Tim Graham
Please use django-users to get help with usage problems.

On Friday, January 26, 2018 at 8:57:17 AM UTC-5, Anoosha Masood Keen wrote:
>
>
> *Help with error:*
>
>
> AttributeError: 'NoneType' object has no attribute 'startswith'
>
>
> *Code added to settings.py:*
> MIGRATION_MODULES = {}
> for app in INSTALLED_APPS:
> if app:
> #print (app)
> MIGRATION_MODULES[app] = None
> print (MIGRATION_MODULES[app])
>   
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/9b4aea94-64a5-40f7-8531-12cfea9b7e40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error

2018-01-26 Thread 'Anoosha Masood Keen' via Django developers (Contributions to Django itself)
This error came while working with ticket 
#29039 
On Friday, January 26, 2018 at 1:57:17 PM UTC, Anoosha Masood Keen wrote:
>
>
> *Help with error:*
>
>
> AttributeError: 'NoneType' object has no attribute 'startswith'
>
>
> *Code added to settings.py:*
> MIGRATION_MODULES = {}
> for app in INSTALLED_APPS:
> if app:
> #print (app)
> MIGRATION_MODULES[app] = None
> print (MIGRATION_MODULES[app])
>   
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/f2fca665-4ade-4984-a081-213d1f7e3b21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Feature Request: Replacing default template system by a more powerful one: Jinja2

2018-01-26 Thread Tim Graham
Switching the default template system would have a disruptive change on the 
Django ecosystem. For example, contrib.admin doesn't provide Jinja2 
templates. I imagine there are third-party apps in the same situation.

Here's a past thread about the same proposal: 
https://groups.google.com/d/topic/django-developers/Bk-22bKqCTo/discussion

On Friday, January 26, 2018 at 7:31:30 AM UTC-5, Ander Ustarroz wrote:
>
> I have been working a lot with Django and I have always asked myself how 
> is it possible that they decided to use Django Template system rather than 
> Jinja2 , when it is way more 
> intuitive, just like writing natural Python! Someone may argue that  it's 
> matter of taste but I bet they haven't tried both template systems.
>
> Yeah I know... we can still use Jinja2 if we want to, but shouldn't it be 
> the native choice when is obviously the best?
>
> Regards
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/6e0734cb-ae26-4633-b90b-0f3065766833%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error

2018-01-26 Thread Tim Graham
As I mentioned in your other thread, you need to spend more time using 
Django before you work on a ticket that you don't understand. Also, this 
isn't the correct mailing list to get help with a ticket. I guess 
django-core-mentorship might be fine for that, or ask on the ticket itself.

Please don't post the same message to django-users, django-developers, and 
django-core-mentorship.

On Friday, January 26, 2018 at 9:04:06 AM UTC-5, Anoosha Masood Keen wrote:
>
> This error came while working with ticket 
> #29039 
> On Friday, January 26, 2018 at 1:57:17 PM UTC, Anoosha Masood Keen wrote:
>>
>>
>> *Help with error:*
>>
>>
>> AttributeError: 'NoneType' object has no attribute 'startswith'
>>
>>
>> *Code added to settings.py:*
>> MIGRATION_MODULES = {}
>> for app in INSTALLED_APPS:
>> if app:
>> #print (app)
>> MIGRATION_MODULES[app] = None
>> print (MIGRATION_MODULES[app])
>>   
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/c0b917e7-a246-485c-95f3-e63f15c5fc6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Fellow Report -- January 26, 2018

2018-01-26 Thread Carlton Gibson
Hi All. 

This week I reviewed patches on:

https://code.djangoproject.com/ticket/25790 -- Added option to disable 
column sort in admin changelist
https://code.djangoproject.com/ticket/20118 -- Default authorization 
backend returns False when queried for object level permissions
https://code.djangoproject.com/ticket/28403 -- Improve the example for 
FORMAT_MODULE_PATH and add missing formats
https://code.djangoproject.com/ticket/28784 -- Re-phrased the documentation 
for the fake option in migrate command
https://code.djangoproject.com/ticket/28748 -- Made CharField choices' 
check stricter
https://code.djangoproject.com/ticket/8500  -- Allowed overriding the 
default admin site instance.
https://code.djangoproject.com/ticket/27728 -- Allowed overriding admin 
templatetag's templates
https://code.djangoproject.com/ticket/28977 -- Change Local Memory Cache to 
Use LRU
https://code.djangoproject.com/ticket/28838 -- annotations + 
base_manager_name + instance.save() raises exception
https://code.djangoproject.com/ticket/25718 -- Allowed using None as a 
JSONField lookup value.
https://code.djangoproject.com/ticket/9475  -- Allowed add(), create(), etc 
for m2m with through
https://code.djangoproject.com/ticket/29059 -- ChoiceWidget.optgroups() 
doesn't group choices without a group together

I also looked (briefly) at the release blocker: 

https://code.djangoproject.com/ticket/28944 -- Chaining 
values()/values_list() after QuerySet.select_for_update(of=()) crashes

... but needed much more time than I thought reasonable to say anything 
sensible.


Kind Regards,

Carlton

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/60ff98a6-b17d-41fb-a733-53e056347301%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


select_related() for fetching individual fields

2018-01-26 Thread Дилян Палаузов

Hello,

Provided:

class M(models.Model):
n = models.IntegerField()
r = models.IntegerField()
t = models.IntegerField()
s = models.IntegerField()
u = models.IntegerField()

class F(models.Model):
g = models.ForeignKey(M, on_delete=models.CASCADE)
a = models.IntegerField()
b = models.IntegerField()
c = models.IntegerField()
d = models.IntegerField()
e = models.IntegerField()


I want to obtain with a queryset all fields from F and M.n, but not the other 
fields of M like M.r, so that a single SELECT is generated, that doesn't pick 
unnecessary columns.

F.objects.select_related('g').defer('g__r', 'g__t', 'g__s', 'g__u') does work, 
but I don't like it, as I want to say only M.n has to be obtained, and not the 
others.

prefetch_related() is also suboptimal, as it creates two SQL queries instead of 
one. only() does not let me specify 'All fields of F'.

So here neither only() nor defer() nor prefetch_related() are good.

F.objects.select_related('g__n') would fit from logic, but does not work 
(django.core.exceptions.FieldError: Non-relational field given in 
select_related: 'n'. Choices are: (none))

I propose teaching select_related() to accept the above expression.

Confer https://code.djangoproject.com/ticket/29072 .

Regards
  Дилян

--
You received this message because you are subscribed to the Google Groups "Django 
developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/d9a58b37-d084-2efe-33b0-4cd9b8289796%40aegee.org.
For more options, visit https://groups.google.com/d/optout.


Re: select_related() for fetching individual fields

2018-01-26 Thread Adam Johnson
F.objects.select_related('g__n') looks a bit convoluted to me.

You can already do something like F.objects.select_related('g').only('g__n',
*[f.name for f in F._meta.get_fields()]) and write a small helper function
for the list comprehension to avoid typing.

Also I'd say it's generally a rare case that such an optimization is worth
it, so it's probably not useful to add ORM shortcut syntax for it.

On 26 January 2018 at 17:24, Дилян Палаузов  wrote:

> Hello,
>
> Provided:
>
> class M(models.Model):
> n = models.IntegerField()
> r = models.IntegerField()
> t = models.IntegerField()
> s = models.IntegerField()
> u = models.IntegerField()
>
> class F(models.Model):
> g = models.ForeignKey(M, on_delete=models.CASCADE)
> a = models.IntegerField()
> b = models.IntegerField()
> c = models.IntegerField()
> d = models.IntegerField()
> e = models.IntegerField()
>
>
> I want to obtain with a queryset all fields from F and M.n, but not the
> other fields of M like M.r, so that a single SELECT is generated, that
> doesn't pick unnecessary columns.
>
> F.objects.select_related('g').defer('g__r', 'g__t', 'g__s', 'g__u') does
> work, but I don't like it, as I want to say only M.n has to be obtained,
> and not the others.
>
> prefetch_related() is also suboptimal, as it creates two SQL queries
> instead of one. only() does not let me specify 'All fields of F'.
>
> So here neither only() nor defer() nor prefetch_related() are good.
>
> F.objects.select_related('g__n') would fit from logic, but does not work
> (django.core.exceptions.FieldError: Non-relational field given in
> select_related: 'n'. Choices are: (none))
>
> I propose teaching select_related() to accept the above expression.
>
> Confer https://code.djangoproject.com/ticket/29072 .
>
> Regards
>   Дилян
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/django-developers/d9a58b37-d084-2efe-33b0-4cd9b8289796%40aegee.org.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM3bpJnz%2BPNux3XG0VEWJV0vMjqJ2ex_uQyU5nLL3wjS1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Ticket #29066

2018-01-26 Thread askpriyansh
Hello everyone !

I have two queries with respect to the ticket #29066 
.

1. Do we need to provide an __neg__ operator for the Sum class, or its 
superclass Aggregate class ? Going by the description in the ticket, the 
operator should probably support all aggregates.
2. Should there be tests for this ? The flag is not set, but I think there 
should be.

Regards
Priyansh

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/d6cdd454-d0c7-42b9-81a2-fdaccdf2490d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.