I need to fetch it from different models. If you want I can share models snapshot
On Fri, 19 Feb 2021 at 15:52, Chetan Ganji <ganji.chetan@gmail.com> wrote:
--Hi KritikaYe chanel mein firangi log bhi hai, unko hinglish kaisa samjhenga? 😂Teko field pe unique constraint lagana padengaTeko no wapas 1 se start karneke liye query maarana padengalast_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 <rkritikapaul17@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+unsubscribe@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.
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+unsubscribe@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.
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BQJGq4MRsKMYkaUZh1u-Phxk4QOG1g%3DYZWf7QGUGiqEXfFjXA%40mail.gmail.com.
No comments:
Post a Comment