#11398 closed New feature (fixed)
pre_syncdb signal to signal before creating tables for models
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Management commands) | Version: | |
Severity: | Normal | Keywords: | |
Cc: | luiz.vital@…, stvsmth, donald@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The reason for having pre_syncdb is handling special situations like creating custom datatypes. The patch attached is very straightforward.
P.S. There is also #4528, but it's been unattended for *quite* a while.
Attachments (2)
Change History (25)
by , 15 years ago
Attachment: | pre_syncdb.diff added |
---|
comment:1 by , 15 years ago
milestone: | 1.1 |
---|
Do not add feature requests to the 1.1 milestone; only absolutely critical bugs should use it at this point; new features will be up for discussion once 1.1 is out the door and 1.2 is being planned.
comment:3 by , 15 years ago
Has patch: | set |
---|
comment:4 by , 15 years ago
milestone: | → 1.2 |
---|
comment:5 by , 15 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:6 by , 15 years ago
milestone: | 1.2 |
---|
comment:7 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:8 by , 13 years ago
Cc: | added |
---|---|
Easy pickings: | unset |
UI/UX: | unset |
comment:9 by , 13 years ago
Cc: | removed |
---|
I have a simple use case for this:
I'm using GeoDjango and I need to INSERT custom projections to the spatial_ref_sys
postgis table before any geometry field is created, because they will use the custom SRID.
This signal would be handy, specially when creating test databases.
comment:10 by , 13 years ago
Cc: | added |
---|
comment:12 by , 12 years ago
Note: If you want to apply this patch on Windows, you may need to resave the patch file in MS-DOS compatible mode.
- Open with wordpad
- Select File->Save As
- Give it a name and select the format as: Text Document - MS-DOS format
It should work after making this change
comment:13 by , 12 years ago
Note: If you want to apply this patch on Windows, you may need to resave the patch file in MS-DOS compatible mode.
- Open with wordpad
- Select File->Save As
- Give it a name and select the format as: Text Document - MS-DOS format
It should work after making this change
comment:14 by , 12 years ago
Component: | Core (Other) → Core (Management commands) |
---|
comment:15 by , 12 years ago
Triage Stage: | Design decision needed → Accepted |
---|
While I'm violently against signals in general, this one doesn't look too dangerous.
comment:16 by , 12 years ago
I see that this has a patch, tests and documentation and that it was recently accepted.
It does seem to have an old version attribute (1.1.beta).
Is there anything I can do to assist with this ticket? We us a similar custom patch and I would like to get out of the business of patching Django.
comment:17 by , 12 years ago
Cc: | added |
---|---|
Version: | 1.1-beta |
comment:18 by , 12 years ago
Cc: | added |
---|
comment:19 by , 12 years ago
I think we don't want to send pre_syncdb from flush. I know post_syncdb is sent from flush, but that seems wrong, and it makes post_syncdb harder than necessary to use for schema changes. I am not even sure what one could do in pre_syncdb signal sent from flush. Creating data doesn't work, it is going to be flushed anyway, doing schema changes in pre_syncdb seems wrong, too. Maybe creating data for unmanaged models, but then those aren't ever flushed...
Could we at least add a kwarg "flush=True/False" to the signal, even if it is a bit silly to get a post_syncdb signal from flush?
I would prefer to add post_flush signal and stop sending post_syncdb from flush, but doing that is a direct break of the backwards compatibility rules... Ideas how to do that in backwards-compat way?
Otherwise the patch looks sane (patch not reviewed, just skimmed...). I am referring to: https://github.com/dstufft/django/compare/pre-syncdb-signal
comment:20 by , 12 years ago
It's sent there to be consistent with post_syncdb.
I would however be agreeable to not doing pre_syncdb there. As far as post_syncdb goes that's another issue that you should probably open up a ticket for so a new signal can be added and flush triggering post_syncdb can be deprecated.
comment:21 by , 12 years ago
I think it is a good idea to not send pre_syncdb from flush. I just don't see any use for that.
In addition, in separate ticket lets add a "flush" argument to post_syncdb so that one can distinguish between flush and syncdb in the signal. This is somewhat ugly, but I don't feel like tackling the backwards compatibility problems. Anyways, this is another ticket's problem.
comment:22 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch