Re: Migration Questioner and String-Type Fields

2016-09-11 Thread Jarek Glowacki
Mm, convenience over strict correctness. Perhaps all that's needed is a 
slight rephrasing of the prompt and we can have both?

Adding field with no `blank=True` and no `null=True`:

You are trying to add a non-nullable field '%s' to %s without a default; we 
can't do that (the database needs something to populate existing rows). 
[provide default | cancel]

Removing `null=True` from field:

You are trying to change the nullable field '%s' on %s to non-nullable 
without a default; we can't do that (the database needs something to 
populate existing rows). [provide default | fix later | cancel]

Removing `blank` from field:

?? (I only skimmed the code; not sure if this even opens up questioner) 


This kind of implies to the user that they're doing something wrong. Maybe 
if, for string fields, it read something more along the lines of:

You are adding/altering a field without setting `blank=True`. This will 
populate existing rows with emptystring despite it being an invalid form 
input. Are you sure? [yes | let me provide a one-time default for existing 
rows | cancel]


So basically changing "you can't do this!" (exception-esque) to "are you 
sure you want this?" (warning-esque).

Anyway I think I'll leave it here. I've exhausted my discussion points now, 
and you already resolved my particular use case back in the ticket, so I no 
longer feel so strongly about this to continue trying to push for a change 
(though am willing to submit a PR if any of the suggested changes are 
approved).

Cheers,


On Saturday, September 10, 2016 at 10:08:27 AM UTC+10, Tim Graham wrote:
>
> Sure, but I don't think that use case should take priority. It's not much 
> work to type an empty string into the questioner if that's what you want. 
> If we remove the prompt, it's significantly more work (editing a migration 
> file or using RunPython) for a developer to set a non-empty value.
>
> On Friday, September 9, 2016 at 7:19:37 PM UTC-4, Jarek Glowacki wrote:
>>
>> Instances created afterwards, via `MyModel.objects.create()`, with this 
>> field unset won't pass form validation either.
>> The use case is where this field is not expected to appear on a Django 
>> form.
>>
>> On Friday, September 9, 2016 at 11:58:38 PM UTC+10, Tim Graham wrote:
>>>
>>> If blank=False, then a new column with a non-blank value means that all 
>>> existing objects won't pass form validation. Therefore, I don't see why a 
>>> prompt for a value isn't helpful.
>>>
>>> On Friday, September 9, 2016 at 6:42:02 AM UTC-4, Jarek Glowacki wrote:

 I made a rant/ticket regarding the hidden usage of `blank` here: #27197 
 .

 In short, I don't think that `blank` should dictate whether or not the 
 migration questioner runs.
 Building on this, I don't think it should run for for string-type 
 fields at all. If they have `default` set, use that for existing rows. 
 Else 
 if they have `null=True`, set existing rows to `NULL`. Else, set existing 
 rows to empty string.

 See linked rant/ticket for some (hopefully) compelling arguments..

 Thoughts?

>>>

-- 
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/60bf1464-7e70-41c4-b8de-b201af84b4b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Channels Load Testing Results

2016-09-11 Thread Robert Roskam
Hello All,

The following is an initial report of Django Channels performance. While 
this is being shared in other media channels at this time, I fully expect 
to get some questions or clarifications from this group in particular, and 
I'll be happy to add to that README anything to help describe the results.

https://github.com/django/channels/blob/master/loadtesting/2016-09-06/README.rst


Robert Roskam

-- 
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/119c3f8d-8f12-46ea-89bc-ab2b7a9084c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: dumpdata --natural-primary --natural-foreign not serializing pointers to parents in multi-table inheritance

2016-09-11 Thread João Sampaio
Hello.

I just sent a pull request for this bug, you can check it out here:
https://github.com/django/django/pull/7231
This is the first pull request I ever sent to a project, so I'm pretty
excited. If there's something to fix in the pull request, let me know!
There's a test to catch a regression and it's passing now.
Also, is there any chance we can backport this to 1.10.2? I think this
bug is critical because it causes *loss of data* if someone is exporting
their database using dumpdata.

Thanks!

On Sat, Sep 10, 2016 at 12:04 PM, João Sampaio  wrote:

> Great! I've been wanting to contribute to Django for a long time, so I'll
> take a shot at this, hopefully I can help.
>
> On Sat, Sep 10, 2016 at 11:56 AM, charettes  wrote:
>
>> Hi João,
>>
>> It seems like this is an already reported bug[1] with an existing stale
>> PR[2]
>> you might want to work on.
>>
>> Cheers,
>> Simon
>>
>> [1] https://code.djangoproject.com/ticket/24607
>> [2] https://github.com/django/django/pull/4473
>>
>>
>> Le samedi 10 septembre 2016 10:32:01 UTC-4, João Sampaio a écrit :
>>>
>>> Hello!
>>>
>>> I have these classes:
>>>
>>> class SuperClassManager(models.Manager):
>>> def get_by_natural_key(self, identifier):
>>> return self.get(identifier=identifier)
>>>
>>>
>>> class SuperClass(models.Model):
>>> objects = SuperClassManager()
>>>
>>> identifier = models.CharField(max_length=31, unique=True)
>>>
>>> def natural_key(self):
>>> return (self.identifier, )
>>>
>>>
>>> class SubClass(SuperClass):
>>> *pass*
>>>
>>>
>>> *class* SubClassTwo(SuperClass):
>>> pass
>>>
>>> When I do
>>>
>>> ./manage.py dumpdata --natural-foreign --natural-primary --indent 4 app
>>>
>>> I get:
>>>
>>> [
>>> {
>>> "model": "app.superclass",
>>> "fields": {
>>> "identifier": "one",
>>> }
>>> },
>>> {
>>> "model": "app.superclass",
>>> "fields": {
>>> "identifier": "two",
>>> }
>>> },
>>> {
>>> "model": "app.subclass",
>>> "fields": {}
>>> },
>>> {
>>> "model": "app.subclasstwo",
>>> "fields": {}
>>> }
>>> ]
>>>
>>> The problem is: superclass of identifier one is a subclass or a
>>> subclasstwo? There's no way to tell. Shouldn't the output be
>>>
>>> [
>>> {
>>> "model": "app.superclass",
>>> "fields": {
>>> "identifier": "one",
>>> }
>>> },
>>> {
>>> "model": "app.superclass",
>>> "fields": {
>>> "identifier": "two",
>>> }
>>> },
>>> {
>>> "model": "app.subclass",
>>> "fields": {
>>> "superclass_ptr": [
>>> "one"
>>> ]
>>> }
>>> },
>>> {
>>> "model": "app.subclasstwo",
>>> "fields": {
>>> "superclass_ptr": [
>>> "two"
>>> ]
>>> }
>>> }
>>> ]
>>>
>>> Now you can tell that superclass of identifier "two" is actually a
>>> subclasstwo!
>>>
>>> Now, I did the homework. I digged into the code. :-)
>>>
>>> Happens that *OneToOneFields* that are *parent_links* are marked as
>>> *serialize=False*, so they never get serialized! Even if you create the
>>> field manually in the model, if will still be marked as serialize=False.
>>>
>>> Shouldn't *OneToOneFields* that point to parents in *multi-table
>>> inheritance* be serialized? Otherwise, how can you tell which subclass
>>> is the superclass in the serialized output?
>>>
>>> What do you think? Do you think this is an issue to be resolved and, if
>>> so, can I submit a pull request?
>>>
>>> Thanks.
>>>
>> --
>> 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/5ef1c557-8364-488a-9462-764d4db4f6fa%
>> 40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/CAO_YKa3fASzzi-HSFQbhCTtxdebct%3DHXn9ZA1Kn9dpaaTdr8BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Contributing to Django

2016-09-11 Thread rishucoding
Hi everyone!

I found Django interesting and so, I want to contribute to it. I am 
learning OOP , web development. I have done a course in C language. My 
mathematics is good. Please suggest in detail, how can I contribute and 
where and how to start? I haven't contributed anything till now but have a 
urge to do so. Please give directions in the sense  what to learn. Your 
help is highly appreciated. 

-- 
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/9b38a592-dfa6-4e50-8207-dcf44e711bc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Contributing to Django

2016-09-11 Thread Abdulrahman Alotaibi
Hi Rishu,

Welcome and I am glad that you choose Django as your first project. You
mentioned that you did a course in C and that's great. You need to know
Python because Django is written in it http://www.diveintopython3.net/ .
Also, you need to learn Git https://git-scm.com/ . Like other open source
project, Django has a process for accepting code and this link has
information about it https://docs.djangoproject.com/en/1.10/internals

/contributing/
 .

Abdulrahman

On Sun, Sep 11, 2016 at 4:30 PM  wrote:

> Hi everyone!
>
> I found Django interesting and so, I want to contribute to it. I am
> learning OOP , web development. I have done a course in C language. My
> mathematics is good. Please suggest in detail, how can I contribute and
> where and how to start? I haven't contributed anything till now but have a
> urge to do so. Please give directions in the sense  what to learn. Your
> help is highly appreciated.
>
> --
> 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/9b38a592-dfa6-4e50-8207-dcf44e711bc3%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Sincerely,
Abdulrahman Alotaibi

-- 
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/CAMCoxY-0Gm0dOaYraM%3D8h2u5%3DMNGKCMGK%3D3tdKi7ffiwos4STg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.