e" object can be used to get the "id" value.
>
> On Wednesday, 27 May 2020 14:22:41 UTC+2, Kasper Laudrup wrote:
>>
>> Hi Anselme,
>>
>>
>> On 27/05/2020 13.33, Anselme SERI wrote:
>> >
>> > What I want to do is fill in the &
onvert it to string then the number will
> show
>
> On Monday, May 25, 2020 at 5:48:29 AM UTC+14, Anselme SERI wrote:
>>
>> from django.db import models
>>>
>>>
>>> def codeid():
>>> lastid = MyModel.objects.last(id)
>>>
to convert it to string then the number will
> show
>
> On Monday, May 25, 2020 at 5:48:29 AM UTC+14, Anselme SERI wrote:
>>
>> from django.db import models
>>>
>>>
>>> def codeid():
>>> lastid = MyModel.objects.last(id)
>>> au
field should not be resetting the '0'
> to a '1' as this is then misrepresenting the actual data.
>
> PS The logic to create the string looks a bit clunky; why not use rjust to
> get the correct number of prefix zeros?
>
> On Monday, 25 May 2020 22:33:30 UTC+2, Ans
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 a
écrit :
> Hi Anselme,
>
> On 24/05/2020 17.48, Anselme SERI wrote:
> >
> > I try to to write a correct functio
>
> from django.db import models
>
>
> def codeid():
> lastid = MyModel.objects.last(id)
> autocode = ''
> if lastid == 0:
> autocode = 'BAC1'
> elif lastid != 0:
> if len(lastid) <= 8:
> lastid += 1
> autocode = 'D/BAC/' + la
[image: nscreen.jpg]
Hello, I have been struggling for a few days wanting to install Microsoft
visual C ++ 14.0 to be able to use mysqlclient in my Django projects. I use
Win10, Python 3.8.2 and Django 3.0.5. Has anyone ever encountered this
problem and solved it? I need help.
--
You receive
ed to
default charfield. Have you an example ? Help me plz.
Le mer. 6 mai 2020 à 18:44, Motaz Hejaze 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,
> wrote:
>
>> Hi,
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 a
Je suis un nouveau dans le développement python et je teste actuellement
Django.
Il m'est impossible d'utiliser le language_code 'fr-fr' dans django 3.0.4.
Le message d'erreur qui s'affiche dans le terminal est le suivant :
"ERRORS:
?: (translation.E004) You have provided a value for the LANGUAGE
10 matches
Mail list logo