I'm trying to make a code-name(i.e: Test Post will be TP-1, TP-2 ...) thing on Django. There is news model, and post model i got. When user create news title hence post's codename will be according it's news's title. For example the
then assume that I created a first post and assign it in variable a
print a.codename must return
Currently i can take News title by it's abbreviation in 2 or 3 letter and problem is how to add number after letters. And Posts are related to News by
ForeignKey therefore number should increase according news like shown below.
It looks like you're new here. If you want to get involved, click one of these buttons!