[Django] #26144: Dumping a proxy model does nothing

68 views
Skip to first unread message

Django

unread,
Jan 27, 2016, 5:22:05 AM1/27/16
to django-...@googlegroups.com
#26144: Dumping a proxy model does nothing
--------------------------------------------+------------------------------
Reporter: kissgyorgy | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Management commands) | Version: 1.9
Severity: Normal | Keywords: dumpdata, models
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------------+------------------------------
When someone runs ```manage.py dumpdata``` on a proxy model, it just gives
an empty list output. The command at least should warn that the data
cannot be dumped.

--
Ticket URL: <https://code.djangoproject.com/ticket/26144>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 27, 2016, 10:01:19 AM1/27/16
to django-...@googlegroups.com
#26144: Warn if a proxy model is an argument to dumpdata
-------------------------------------+-------------------------------------
Reporter: kissgyorgy | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 1.9
commands) |
Severity: Normal | Resolution:
Keywords: dumpdata, models | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: => 1
* needs_tests: => 0
* needs_docs: => 0
* has_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Looking at the proposed [https://github.com/django/django/pull/6051 pull
request], I think it would be fine to warn if the proxy model is specified
in the command args, e.g. `dumpdata app.ProxyModel`, but otherwise I think
warnings would clutter the output.

--
Ticket URL: <https://code.djangoproject.com/ticket/26144#comment:1>

Django

unread,
Jan 27, 2016, 11:52:36 AM1/27/16
to django-...@googlegroups.com
#26144: Warn if a proxy model is an argument to dumpdata
-------------------------------------+-------------------------------------
Reporter: kissgyorgy | Owner: nobody

Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 1.9
commands) |
Severity: Normal | Resolution:
Keywords: dumpdata, models | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by kissgyorgy):

What about warn and add an ```--ignore-warnings``` option to the dumpdata
command?

What happened me that I lost data when I dumped my "core" app, assuming it
would dump everything.

--
Ticket URL: <https://code.djangoproject.com/ticket/26144#comment:2>

Django

unread,
Jan 27, 2016, 12:26:16 PM1/27/16
to django-...@googlegroups.com
#26144: Warn if a proxy model is an argument to dumpdata
-------------------------------------+-------------------------------------
Reporter: kissgyorgy | Owner: nobody

Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 1.9
commands) |
Severity: Normal | Resolution:
Keywords: dumpdata, models | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

I don't see an advantage of burdening everyone that uses proxy models with
warnings for normal `dumpdata` usage. If we extended the warning to if an
app is specified like `dumpdata app` would that have helped?

The behavior seems intuitive to me, however, the
[https://docs.djangoproject.com/es/1.9/ref/django-admin/#dumpdata-app-
label-app-label-app-label-model dumpdata documentation] doesn't seem to
mention it, so that's a candidate for an update as well.

--
Ticket URL: <https://code.djangoproject.com/ticket/26144#comment:3>

Django

unread,
Jan 28, 2016, 10:43:48 AM1/28/16
to django-...@googlegroups.com
#26144: Warn if a proxy model is an argument to dumpdata
-------------------------------------+-------------------------------------
Reporter: kissgyorgy | Owner: nobody

Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 1.9
commands) |
Severity: Normal | Resolution:
Keywords: dumpdata, models | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by kissgyorgy):

Replying to [comment:3 timgraham]:


> I don't see an advantage of burdening everyone that uses proxy models
with warnings for normal `dumpdata` usage. If we extended the warning to
if an app is specified like `dumpdata app` would that have helped?

Sure, because if you dumpdata without parameters, everything will be
dumped. Absolutely not necessary to warn in that case at all.

It would be just nice if it would warn that you "might" lose some data if
somebody is unobservant like me :)

--
Ticket URL: <https://code.djangoproject.com/ticket/26144#comment:4>

Django

unread,
Jan 28, 2016, 11:10:31 AM1/28/16
to django-...@googlegroups.com
#26144: Warn if a proxy model is an argument to dumpdata
-------------------------------------+-------------------------------------
Reporter: kissgyorgy | Owner: nobody

Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 1.9
commands) |
Severity: Normal | Resolution:
Keywords: dumpdata, models | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by charettes):

What about issuing a warning if a proxy model is included but not the
concrete model it's proxying?

Since `dumpdata` uses `_base_manager` the concrete model instances
returned should be the same as what the proxy instances would have been.

--
Ticket URL: <https://code.djangoproject.com/ticket/26144#comment:5>

Django

unread,
Feb 1, 2016, 1:42:52 PM2/1/16
to django-...@googlegroups.com
#26144: Warn if a proxy model is an argument to dumpdata
-------------------------------------+-------------------------------------
Reporter: kissgyorgy | Owner: nobody

Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 1.9
commands) |
Severity: Normal | Resolution:
Keywords: dumpdata, models | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

If not too complicated, sounds good to me.

--
Ticket URL: <https://code.djangoproject.com/ticket/26144#comment:6>

Django

unread,
Feb 4, 2016, 11:01:32 AM2/4/16
to django-...@googlegroups.com
#26144: Warn if a proxy model is an argument to dumpdata
-------------------------------------+-------------------------------------
Reporter: kissgyorgy | Owner: nobody

Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 1.9
commands) |
Severity: Normal | Resolution:
Keywords: dumpdata, models | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


Comment:

Looks good, pending some cosmetic edits.

--
Ticket URL: <https://code.djangoproject.com/ticket/26144#comment:7>

Django

unread,
Feb 4, 2016, 7:41:37 PM2/4/16
to django-...@googlegroups.com
#26144: Warn if a proxy model is an argument to dumpdata
-------------------------------------+-------------------------------------
Reporter: kissgyorgy | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Core (Management | Version: 1.9
commands) |
Severity: Normal | Resolution: fixed

Keywords: dumpdata, models | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"0edb8a146fd6c60f4c3b1ad0a4a89963962f22af" 0edb8a1]:
{{{
#!CommitTicketReference repository=""
revision="0edb8a146fd6c60f4c3b1ad0a4a89963962f22af"
Fixed #26144 -- Warned when dumping proxy model without concrete parent.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26144#comment:8>

Django

unread,
Feb 5, 2016, 12:32:52 PM2/5/16
to django-...@googlegroups.com
#26144: Warn if a proxy model is an argument to dumpdata
-------------------------------------+-------------------------------------
Reporter: kissgyorgy | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: Core (Management | Version: 1.9
commands) |
Severity: Normal | Resolution: fixed
Keywords: dumpdata, models | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Simon Charette <charette.s@…>):

In [changeset:"275314512d7dd10065026f02f61931e4c62c9cc8" 27531451]:
{{{
#!CommitTicketReference repository=""
revision="275314512d7dd10065026f02f61931e4c62c9cc8"
Refs #26144 -- Used proxy_for_model instead of mro inspection.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26144#comment:9>

Reply all
Reply to author
Forward
0 new messages