Thanks you for your answer. I know how to make a default value in charfield
but I don't know  how to build function which returns value for my default
field. In my case this function must retrieve last id on my model and must
concataned it with a string and the final result must be affected to
default charfield. Have you an example ? Help me plz.

Le mer. 6 mai 2020 à 18:44, Motaz Hejaze <[email protected]> a écrit :

> Yes you can make a normal charfield and assign its default attribute to a
> function you declare
>
> On Wed, 6 May 2020, 6:53 pm Anselme SERI, <[email protected]>
> wrote:
>
>> Hi,
>>
>> I use Django 3.0 and I would like to create a function which fill
>> automatically a field in my models.
>> Can I do it directly in models.py ? How?
>>
>> Thanks a lot
>>
>> --
>> 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/5f810453-c7ca-4c10-bca1-4cfe11ea496a%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/5f810453-c7ca-4c10-bca1-4cfe11ea496a%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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-dDRD%3DLteuDo7KuATzjKem-ThvtozzHuaqkwAeAC%2BBrZw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHV4E-dDRD%3DLteuDo7KuATzjKem-ThvtozzHuaqkwAeAC%2BBrZw%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACbA33rshU-SxKu89dTUXAKfvkbBCxyUGY4F1_qhT3nOYRf%3Dzw%40mail.gmail.com.

Reply via email to