--
Ticket URL: <https://code.djangoproject.com/ticket/17337>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
Accepting the ticket, as support for non-integer auto-fields is certainly
desirable. I believe there's a different implementation of it in Alex
Gaynor's 2010 GSoC code - I don't know which implementation is preferable.
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:1>
Comment (by russellm):
IIRC, Alex's GSoC code punted on this issue (or, at least, had code that
wasn't suitable for trunk), because we couldn't come up with a way to
introduce it without introducing backwards incompatibilities. I seem to
recall there were a bunch of places in the code that assumed that
AutoFields were integers; however, it's been a while, so I might be mis-
remembering.
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:2>
Comment (by jonash):
A few contrib apps assume PKs to be integers and also it gets tricky when
it comes to testing with fixtures. Should we address all these issues at
once or fix them bit by bit in multiple tickets?
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:3>
* type: Uncategorized => Bug
Comment:
Two tickets (#17214, #17122) were recently reported about problems in the
admin with models using non-integer primary keys. A quick
[https://code.djangoproject.com/search?q=primary_key&noquickjump=1&ticket=on
search for "primary_key"] turns up lots of other problems with non-integer
primary keys. Clearly people are trying to use them, and as far as I can
see, [https://docs.djangoproject.com/en/dev/ref/models/fields/#primary-key
the docs] don't forbid it.
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:4>
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:5>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:6>
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:7>
Comment (by Nick Pope):
This is partially addressed by
[https://github.com/django/django/pull/10680 PR] for #29979, but will
further depend on #470 for default values for non-integer fields as well
as #24042 for replacing `isinstance(..., AutoField)` checks.
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:8>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"21e559495b8255bba1e8a4429cd083246ab90457" 21e5594]:
{{{
#!CommitTicketReference repository=""
revision="21e559495b8255bba1e8a4429cd083246ab90457"
Fixed #29979, Refs #17337 -- Extracted AutoField field logic into a mixin
and refactored AutoFields.
This reduces duplication by allowing AutoField, BigAutoField and
SmallAutoField to inherit from IntegerField, BigIntegerField and
SmallIntegerField respectively. Doing so also allows for enabling the
max_length warning check and minimum/maximum value validation for auto
fields, as well as providing a mixin that can be used for other possible
future auto field types such as a theoretical UUIDAutoField.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:9>
* cc: Brian Helba (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:10>
* owner: nobody => raydeal
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:11>
* cc: raydeal (added)
* owner: raydeal => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/17337#comment:12>