Yes you can keep custom primary key. Pass `primary_key=True` in your model
and Django won't create a primary key for that model.

Here are relevant docs:
https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.Field.primary_key

On Fri, 5 Feb 2016 at 20:52 Uri Even-Chen <u...@speedy.net> wrote:

> To django-developers@googlegroups.com,
>
> I'm a Django user and I'm working on converting Speedy Net from PHP to
> Django. I would like to know if it's possible in Django to change the
> primary key of Django models, such as User? I don't like the auto-increment
> default primary key, it doesn't make sense, and I want to use the primary
> key of users and pages also in urls. And therefore I decided that the id of
> users and pages, causes, groups and events on Speedy Net will be 15
> randomly generated digits. Users who already created accounts and pages on
> Speedy Net (with PHP) already have a 15-digits id, and I want to preserve
> this number when converting Speedy Net to Django. Is it possible? I don't
> want the id/primary key to be short (such as zuck's id on Facebook -
> https://www.facebook.com/messages/4) but 15-digits long.
>
> Thanks,
> Uri.
>
> *Uri Even-Chen*
> [image: photo] Phone: +972-54-3995700
> Email: u...@speedy.net
> Website: http://www.speedysoftware.com/uri/en/
> <http://www.facebook.com/urievenchen>
> <http://plus.google.com/+urievenchen>
> <http://www.linkedin.com/in/urievenchen>  <http://twitter.com/urievenchen>
>
>
> ---------- Forwarded message ----------
> From: Uri Even-Chen <u...@speedy.net>
> Date: Thu, Feb 4, 2016 at 6:20 PM
> Subject: ID for users of Speedy Net
> To: django-us...@googlegroups.com
> Cc: speedy-mail-softw...@googlegroups.com
>
>
> To django-us...@googlegroups.com,
>
> I'm working on the next version of Speedy Net <http://en.speedy.net/>,
> which will be based on Django 1.9.2 and Python 3.5 / 3.4. You can see the
> specification of Speedy Net on
> https://github.com/urievenchen/speedy-net/tree/master/speedy_net/specifications
>  (the
> file is System Requirements Specification - Speedy Net.txt). The old code
> is in PHP and can be found on
> https://www.assembla.com/spaces/speedynet/subversion/source (all the
> Speedy Net projects are free software and open source). According to my
> specification, each user will have a unique ID of 15 digits (a
> number between 100,000,000,000,000 and 999,999,999,999,999, randomly
> generated), which will be unique over the system (of users, pages, groups,
> causes and events). And each user will have a username, and pages, groups
> and causes may also have an optional username (it's called "username" also
> on Facebook).
>
> So my question is, can I make this random ID the primary key of the User
> model? I don't want users to have 2 ids - one for Django and one of Speedy
> Net, it doesn't make sense. I want the id to be the same and unique. I also
> want to have an Id model to prevent a page and a user (for example) to have
> the same ID. And a Username model to prevent them from having the same
> username. Is it possible to do it with Django 1.9.2?
>
> By the way, if you want to help me develop Speedy Net, Speedy Composer,
> Speedy Match or Speedy Mail, please let me know. If you want you can also
> join Speedy Net and grab yourself a username at Speedy Net. I'm also
> sending a copy of this message to speedy-mail-softw...@googlegroups.com,
> the list of developers of the Speedy Net projects.
>
> I have another, off-topic question. Anyone knows how I can create a
> company in Switzerland, and how much does it cost? Any links to lawyers who
> can do it for me? I decided to host Speedy Net in Switzerland, because of
> the privacy laws there, and I prefer a Swiss company for the same reason
> (Israel is much less advanced in privacy than Europe and Switzerland). I'm
> a resident and citizen of Israel, with an option to become a Spanish
> citizen too. And I don't want to host private information of people in
> Israel.
>
> Thanks,
> Uri.
>
> *Uri Even-Chen*
> [image: photo] Phone: +972-54-3995700 <+972-54-3995700>
> Email: u...@speedy.net <u...@speedy.net>
> Website: http://www.speedysoftware.com/uri/en/
> <http://www.speedysoftware.com/uri/en/>
> <http://www.facebook.com/urievenchen>
> <http://plus.google.com/+urievenchen>
> <http://www.linkedin.com/in/urievenchen>  <http://twitter.com/urievenchen>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAMQ2MsGMip-WreMzjrpZFxJUB3edJz9RQoiMLoo5tEwjU-7pfw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CAMQ2MsGMip-WreMzjrpZFxJUB3edJz9RQoiMLoo5tEwjU-7pfw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAByqUggEguOuT0cw-xeJaP5j3nFVNnxLo6V_xPoDzxeFJcXFJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to