Si tu pouvais aussi envoyer le code du modèle et du formulaire, je pense bien que ton problème sera très rapidement
Le lun. 25 sept. 2023 à 19:44, Baye SALIOU DIAW < bayesalioudiawt...@gmail.com> a écrit : > def ajouterCentre(request): > form = FormCentre() > regions = Region.objects.all() > centrecategories = CentreCategorie.objects.all() > if request.method == 'POST': > > > categorie_name = request.POST.get('categorie') > categorie, created = CentreCategorie.objects.get_or_create(name= > categorie_name) > > region_name = request.POST.get('region') > region, created = Region.objects.get_or_create(name=region_name) > > CentreDeFormation.objects.create( > categorie=request.categorie, > region = region, > nom = request.POST.get('nom'), > description = request.POST.get('description'), > adresse = request.POST.get('adresse'), > telephone = request.POST.get('telephone'), > ) > > return redirect('home') > > > context = { > 'form': form, > 'regions': regions, > 'centrecategories': centrecategories, > } > return render(request, 'blog/ajoutercentre.html', context) > > -- > 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 django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/8a202205-cf75-4445-9642-e995fec56833n%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/8a202205-cf75-4445-9642-e995fec56833n%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 django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAC3RP-CV6qay3-QZXUY0%2BROZ9ALdVW3n3ZV5ky4D%2Bz9xJenm9Q%40mail.gmail.com.