Re: [Django] #24470: Serialization of base classes is not customizable for migrations

2015-03-23 Thread Django
#24470: Serialization of base classes is not customizable for migrations
-+
 Reporter:  rockymeza|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Migrations   |  Version:  1.7
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+

Comment (by MarkusH):

 It would be nice if we can stick to `deconstruct()` and not introduce
 `deconstruct_class()`.

 For serializing model managers we follow the pattern `class
 MyManager(MyBaseManager.from_queryset(CustomQuerySet)):`
 https://docs.djangoproject.com/en/1.8/topics/migrations/#model-managers
 which will also work here I think.

 I have to think about it a bit more, though, but the general feature seems
 useful for more complex projects.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.28de8218514f2e8c3a201760187aec97%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24470: Serialization of base classes is not customizable for migrations

2015-03-19 Thread Django
#24470: Serialization of base classes is not customizable for migrations
-+
 Reporter:  rockymeza|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Migrations   |  Version:  1.7
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by carljm):

 * type:  Uncategorized => New feature
 * stage:  Unreviewed => Accepted


Comment:

 On the one hand, I think there is definitely a point where we just have to
 say "auto-generated migrations are on a best-effort basis, if you're doing
 complex things then you will probably have to edit the auto-generated
 migrations by hand."

 On the other hand, this specific feature request looks relatively elegant
 and generic, and I think would probably find use cases beyond this
 specific situation , so provided the implementation isn't too complex in
 practice I think it's reasonable.

 I've marked accepted, but if anyone with more migrations experience thinks
 there are serious problems here, feel free to reverse that!

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.e112b54d2989b6f9bb82fb2e116b82d6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24470: Serialization of base classes is not customizable for migrations

2015-03-11 Thread Django
#24470: Serialization of base classes is not customizable for migrations
---+--
 Reporter:  rockymeza  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Migrations |  Version:  1.7
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by gavinwahl):

 There are several problems with doing that.

 - The `__module__` of MyMixin will be the `__module__` of
 model_mixin_factory, not the module were MyMixin was created.
 - model_mixin_factory needs to remain backwards compatible. Changing the
 signature would break existing code, and there is existing code that uses
 it without assigning it to a module-level variable
 - It's ugly to specify the name twice

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.6e76094124f2db0793caca2f6e1db6e7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24470: Serialization of base classes is not customizable for migrations

2015-03-10 Thread Django
#24470: Serialization of base classes is not customizable for migrations
---+--
 Reporter:  rockymeza  |Owner:  nobody
 Type:  Uncategorized  |   Status:  new
Component:  Migrations |  Version:  1.7
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by charettes):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Can't you simply define your factored mixin at the module level?

 {{{#!python
 from django.db import models


 def model_mixin_factory(name):
 class cls(object):
 pass
 cls.__name__ = name
 return cls

 MyMixin = model_mixin_factory('MyMixin')


 class MyModel(MyMixin, models.Model):
 pass
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.f659abe5ea7d7b46034c0bf69ce5778d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.