Re: function model which generate a code for model field

2020-05-29 Thread Anselme SERI
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 &

Re: function model which generate a code for model field

2020-05-27 Thread Anselme SERI
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) >>>

Re: function model which generate a code for model field

2020-05-27 Thread Anselme SERI
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

Re: function model which generate a code for model field

2020-05-27 Thread Anselme SERI
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

Re: function model which generate a code for model field

2020-05-25 Thread Anselme SERI
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

function model which generate a code for model field

2020-05-24 Thread Anselme SERI
> > 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

install Microsoft visual C ++ 14.0 to be able to use mysqlclient in my Django projects

2020-05-09 Thread Anselme SERI
[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

Re: Create a function which fill automatically a field in my models

2020-05-06 Thread Anselme SERI
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,

Create a function which fill automatically a field in my models

2020-05-06 Thread Anselme SERI
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

Impossible d'utiliser language_code 'fr-fr' avec django 3.0.4

2020-03-26 Thread Anselme SERI
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