I am using atom feeds within a Django application, and was planning on using a CharField to represent the id field of an entry. Given that max_length
is required, what would be an appropriate length?
Asked
Active
Viewed 71 times
0
-
why do you want to use charfield for id ? Should it not be AutoField ? – karthikr May 19 '13 at 18:13
-
Not for the database id. For the [Atom](http://www.ietf.org/rfc/rfc4287) feed id. – jvc26 May 19 '13 at 18:14
-
There doesn't seem to be anything in the standard to say how long the ID can be, so whatever value you choose, there's always a chance you might encounter a longer one. What's the longest one you've ever encountered yourself? – Aya May 19 '13 at 18:18
-
I would imagine it is the same max length for an IRI (Internationalized Resource Identifier) - which is about 4kb. – karthikr May 19 '13 at 18:19
-
@karthikr Strange. I had a quick look through the IRI spec, and couldn't find any reference to maximum lengths. – Aya May 19 '13 at 18:22
-
1Looks like the IETF have had an [open ticket](http://trac.tools.ietf.org/wg/iri/trac/ticket/47) on this for three years. :-) – Aya May 19 '13 at 18:30
-
Hmm, so perhaps a TextField would be a better way to go potentially – jvc26 May 19 '13 at 20:00
-
See http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers for a related question you may wish to adopt the answer from. – Joe May 21 '13 at 12:25