hello,
I am trying to create a function which will recover the last id of my model
which I will increment and add to a character string, and I would like to
add this new value (x = last id incremented + string) be added to the
"code" field "of my model when I make a new recording.
How else could we use the id field which automatically increments to
perform such an action?

Anselme S.

Le dim. 24 mai 2020 à 20:12, Kasper Laudrup <[email protected]> a
écrit :

> Hi Anselme,
>
> On 24/05/2020 17.48, Anselme SERI wrote:
> >
> > I try  to to write a correct function for my model which  generate a str
> > + incremental number according last id model.
> >
>
> Your code is obviously wrong for quite a few reasons, but I at least
> simply cannot understand what you are trying to achieve.
>
> What should the "correct function" do?
>
> The id field of a model is already incremental. Do you simply want to
> append that to a string and what do you want to do with that string?
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/65ffe493-1190-619a-f904-fbe35b60e3e3%40stacktrace.dk
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACbA33p-1tYWbECsa9j7R82%3DAwTQBNOGuYvMcpmUHb0GPrfQDA%40mail.gmail.com.

Reply via email to