No row will be deleted, also, the code created once will never be assigned
to any other space

On Fri, 19 Feb 2021 at 15:59, shubham vashisht <shubhva...@gmail.com> wrote:

> Chetan
> If any row is deleted from the table, then your logic will fail to return
> the unique code
>
> On Fri, 19 Feb 2021, 15:52 Chetan Ganji, <ganji.che...@gmail.com> wrote:
>
>> Hi Kritika
>>
>> Ye chanel mein firangi log bhi hai, unko hinglish kaisa samjhenga? 😂
>>
>> Teko field pe unique constraint lagana padenga
>>
>> Teko no wapas 1 se start karneke liye query maarana padenga
>>
>> last_no = Model.objects.filter(categorycode="blah",
>> citycode="blah-blah").count()
>>
>> unique_code ="LM" + categorycode
>> + citycode + str(last_no + 1)
>>
>>
>> Aisa code likkha toh result milenga 😋
>>
>>
>> On Fri, Feb 19, 2021, 3:31 PM Kritika Paul <rkritikapau...@gmail.com>
>> wrote:
>>
>>>  I have to create a unique code for each space saved in dbAb db me save
>>> krne k lie, wo multiple part me save ho rha hai, multiple models bhi hai
>>> uske.1st model se mujhe space category ka name uthana hai
>>> 2nd se city code
>>> Category alag alg ho skti hai
>>> To code genrate hoga LM-categorycode-citycode-00001Next time jb
>>> category, B hogi to number 1 se hi start hoga, ni to category same hai to
>>> fr se 2 allot ho jaega
>>> Eg Category - CW, COM
>>> City - Noida, DelhiSpace 1 - Cw category
>>> Code space 1- LMCWNoida00001Space2 - CW Category
>>> CODE SPACE2 - LMCWDelhi00002Space 3 - COM category
>>> CODE SPACE 3- LM-COM-NOIDA0001
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/690debd2-46e0-497f-92a8-3abbc391b97dn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/690debd2-46e0-497f-92a8-3abbc391b97dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMKMUjs6q%2B6Xer6-MRu%3DYjhKq5EYNXahEji%2BY5HBerTaNQ1Law%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMKMUjs6q%2B6Xer6-MRu%3DYjhKq5EYNXahEji%2BY5HBerTaNQ1Law%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJW_r64v1-f85ViX%2BnCFdBrupiXi5Ba%3Dzec6xoSvuZnR1jaMEg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJW_r64v1-f85ViX%2BnCFdBrupiXi5Ba%3Dzec6xoSvuZnR1jaMEg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Regards,

Kritika Paul
rkritikapau...@gmail.com
+91-7905147674

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BQJGq4U2sE_K10Y_EbG_T9bCPnHeQcMfJ-11Ji5MDd%2B6g8AAw%40mail.gmail.com.

Reply via email to