Re: Generating a unique 10 digit ID for each model instance

2017-10-22 Thread Mark Phillips
I thought python's uuid.uuid4 guaranteed a unique value. Am I missing something? Mark On Sun, Oct 22, 2017 at 3:58 PM, James Schneider wrote: > > > On Oct 22, 2017 12:29 PM, "Andréas Kühne" > wrote: > > Hi, > > I think you are correct with

Re: Generating a unique 10 digit ID for each model instance

2017-10-22 Thread James Schneider
On Oct 22, 2017 12:29 PM, "Andréas Kühne" wrote: Hi, I think you are correct with your pseudocode - you can do a Model.objects.filter(unique_code==random_code).count() - and then loop on that. It should work. I wouldn't do this, it can lead to a race condition

Re: Generating a unique 10 digit ID for each model instance

2017-10-22 Thread Andréas Kühne
Hi, I think you are correct with your pseudocode - you can do a Model.objects.filter(unique_code==random_code).count() - and then loop on that. It should work. The reason why I thought you should use the signals is because thats how I have done the same things in the past. However, you can just

Re: Generating a unique 10 digit ID for each model instance

2017-10-22 Thread Jack Zhang
I need this 10-digit unique ID for every model instance so users can easily search up a specific model instance. It will be publicly displayed on the website, unlike a primary key which is usually hidden On Sunday, October 22, 2017 at 1:31:23 PM UTC-4, Avraham Serour wrote: > > The database

Re: Generating a unique 10 digit ID for each model instance

2017-10-22 Thread Jack Zhang
Hi Andréas, Yes, by globally unique I mean a unique 10-digit ID is assigned to every model instance of 'Dogs' within my application. This ID will be shown publicly on the website to allow easy search access to a specific model instance. I think you are right about creating a new field to

Re: Generating a unique 10 digit ID for each model instance

2017-10-22 Thread Avraham Serour
The database usually handles this and you don't need to worry, there are many corner cases and DB systems are able to handle them But they won't look like whatever format you would like, usually it is just a number Why do you need the IDs to look like that? On Oct 22, 2017 6:53 PM, "Jack Zhang"

Re: Live Django application on heroku.

2017-10-22 Thread Harish Soni
I'm getting error status 404 and after open url its showing requested url not found on this server On Oct 22, 2017 7:59 PM, "Chinonso Okoroafor" wrote: > Go to https://devcenter.heroku.com/articles/getting-started- > with-python#introduction you will find your answer

Re: Generating a unique 10 digit ID for each model instance

2017-10-22 Thread Andréas Kühne
Hi, When you say "globally unique" - I am supposing you mean within your application? What you need to do is set a field to be the primary key, see : https://docs.djangoproject.com/en/1.11/topics/db/models/#automatic-primary-key-fields However - it would be simpler to use the standard primary

Generating a unique 10 digit ID for each model instance

2017-10-22 Thread Jack Zhang
Let's say I have a model called 'Dogs'. Users can create instances of Dogs. For every Dogs instance that is created, I want to assign a globally unique ID to it. The ID will be 3 capitalized letters followed by 7 numbers. E.g. ABC1234567, POZ2930193 What is the easiest way to go about

Re: Live Django application on heroku.

2017-10-22 Thread Chinonso Okoroafor
Go to https://devcenter.heroku.com/articles/getting-started-with-python#introduction you will find your answer there On Sunday, October 22, 2017 at 1:15:51 PM UTC+1, Harish Soni wrote: > > Hi All > > I'm having an assignment to make this application live on heroku but I am > not aware about

Live Django application on heroku.

2017-10-22 Thread Harish Soni
Hi All I'm having an assignment to make this application live on heroku but I am not aware about structure and changes what should I have to make it into this project so I can easily make this project to live.. I got so many answers but not understood so if any help from your side would be

Re: dynamic choices based on another field input.

2017-10-22 Thread Derek
See: http://django-autocomplete-light.readthedocs.io/en/master/tutorial.html#filtering-results-based-on-the-value-of-other-fields-in-the-form On Friday, 20 October 2017 13:04:41 UTC+2, rajeev yadla wrote: > > hi have a form which have two fields. one field has a foreignkey from > model A(in

Re: Django 1.11 and PostgreSQL 10 compatibility

2017-10-22 Thread Edandweb
Thanks On Thursday, 19 October 2017 12:27:50 UTC+3, Edandweb wrote: > > Hi, > > I am developing a new application in Python and Django, for the database > we want to use the last version of PostgreSQL v10. > The django Documentation says in >