Re: Unit test to make sure correct template is returned from a specific URL?

2023-09-25 Thread Muhammad Juwaini Abdul Rahman
Use assertTemplateUsed.

https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed

On Sun, 24 Sept 2023 at 22:37, 'Simon Connah' via Django users <
django-users@googlegroups.com> wrote:

> I can write a unit test which checks say the title on a page and compares
> it to a string but that is really prone to breakage. What I want to do
> instead is to check that the template that is returned by the URL is the
> same one that is expected in the unit test. Is there an easy way to do this?
>
> --
> 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/MnCVU2YvJzLiFdMPPAVBwMY7SMosqS5wvqopbySnD05i7BTc375v_Bo5GB4VlUQSd5K2OwsiblAbxsfsz7in96L4_Ou4RTRm0jwVN3aMp54%3D%40protonmail.com
> .
>

-- 
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/CAFKhtoRiz4mr69ZLu7_wCxVFXgjnvmAW3JCoYdcDrx%2Bwu94vrw%40mail.gmail.com.


Re: Unit test to make sure correct template is returned from a specific URL?

2023-09-25 Thread 'Simon Connah' via Django users
Thank you very much!


--- Original Message ---
On Monday, September 25th, 2023 at 14:07, Muhammad Juwaini Abdul Rahman 
 wrote:


> Use assertTemplateUsed.
> https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed
> 

> On Sun, 24 Sept 2023 at 22:37, 'Simon Connah' via Django users 
>  wrote:
> 

> > I can write a unit test which checks say the title on a page and compares 
> > it to a string but that is really prone to breakage. What I want to do 
> > instead is to check that the template that is returned by the URL is the 
> > same one that is expected in the unit test. Is there an easy way to do this?
> > 

> > --
> > 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/MnCVU2YvJzLiFdMPPAVBwMY7SMosqS5wvqopbySnD05i7BTc375v_Bo5GB4VlUQSd5K2OwsiblAbxsfsz7in96L4_Ou4RTRm0jwVN3aMp54%3D%40protonmail.com.
> 

> --
> 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/CAFKhtoRiz4mr69ZLu7_wCxVFXgjnvmAW3JCoYdcDrx%2Bwu94vrw%40mail.gmail.com.

-- 
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/O_3E4w3kT2FE_XgQrWGfQFM_DcKq_syuWJ0eEuZ0zJfIPnZ6rzbF80z28SORLG9r7rik-evYNQhGnchpIcEDOP9zqIX9n_xOntOTHDAbv4M%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Re: Unit test to make sure correct template is returned from a specific URL?

2023-09-25 Thread Abhishek ozha
got some issues in unit test in django,could anypone have a look


On Monday, September 25, 2023 at 7:28:31 PM UTC+5:45 Simon Connah wrote:

> Thank you very much!
>
> --- Original Message ---
>
> On Monday, September 25th, 2023 at 14:07, Muhammad Juwaini Abdul Rahman <
> juw...@gmail.com> wrote:
>
> Use assertTemplateUsed.
>
>
> https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed
>
> On Sun, 24 Sept 2023 at 22:37, 'Simon Connah' via Django users <
> django...@googlegroups.com> wrote:
>
>> I can write a unit test which checks say the title on a page and compares 
>> it to a string but that is really prone to breakage. What I want to do 
>> instead is to check that the template that is returned by the URL is the 
>> same one that is expected in the unit test. Is there an easy way to do this?
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/MnCVU2YvJzLiFdMPPAVBwMY7SMosqS5wvqopbySnD05i7BTc375v_Bo5GB4VlUQSd5K2OwsiblAbxsfsz7in96L4_Ou4RTRm0jwVN3aMp54%3D%40protonmail.com
>> .
>>
> -- 
> 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...@googlegroups.com.
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAFKhtoRiz4mr69ZLu7_wCxVFXgjnvmAW3JCoYdcDrx%2Bwu94vrw%40mail.gmail.com
> .
>
>
>

-- 
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/dff18872-c958-4f7e-ba64-f4e993fa468an%40googlegroups.com.


Re: help me

2023-09-25 Thread Migui Galan
you can try exploring vercel. they can host django website.
other than that, try pythonanywhere. best site for hosting django

On Sun, Sep 24, 2023 at 9:52 AM FIRDOUS BHAT  wrote:

> https://blog.back4app.com/top-10-heroku-alternatives/
>
>
>
>
> On Sun, Sep 24, 2023 at 12:14 AM Akoo Rahimi 
> wrote:
>
>> Hello friends
>>
>> Can you introduce me some sites similar to Heroku?
>>
>> I just started Django and I want to test my projects on the global server.
>>
>> --
>> 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/dccab8c0-8d51-4338-a085-300fdfc0eeadn%40googlegroups.com
>> 
>> .
>>
> --
> 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/CAFB6YJrmzsa8ReiikRC2q3vs8VCkpNQZ0mrvqPLLvmrzaq8FiQ%40mail.gmail.com
> 
> .
>

-- 
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/CAKKJMPOmT66f9dgm%2B69Sqq7b8LLmQw6yFpB4vPSuQheWfHtV4A%40mail.gmail.com.


Re: Mysql for Django

2023-09-25 Thread Mansour Abdullahi Abdirahman
Yes absolutely you can use it , what kind of error have u faced?


On Mon, 25 Sept 2023 at 03:46, DieHardMan 300 
wrote:

> Do you mean you can't use mysqlclient with Django? Do you already install
> homebrew in MAC? Do you already install mysql server using homebrew?
> ในวันที่ วันจันทร์ที่ 25 กันยายน ค.ศ. 2023 เวลา 3 นาฬิกา 50 นาที 25 วินาที
> UTC+7 Lakhjeet Samra เขียนว่า:
>
>> Hi Guys,
>> I am new to Django
>> I use Mac ,
>>  I am unable to down mysqlclient  for Django project any suggestions
>> I have Mysql workbench installed  Is it right.
>>
>> Thank You
>> Lakhjeet
>>
> --
> 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/051ed6a3-574f-4813-b976-0b82b0480019n%40googlegroups.com
> 
> .
>

-- 
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/CAET2c5-Z3szAwgqyTq1uUegKUjRzfO02ucV%2BZ_BSMo6TMt6aWA%40mail.gmail.com.


FieldError at /ajouter_centre Cannot resolve keyword 'name' into field. Choices are: categorie, centredeformation, date_de_crea, id

2023-09-25 Thread Baye SALIOU DIAW
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.


Re: FieldError at /ajouter_centre Cannot resolve keyword 'name' into field. Choices are: categorie, centredeformation, date_de_crea, id

2023-09-25 Thread Dino P.Russe
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
> 
> .
>

-- 
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.


Re: FieldError at /ajouter_centre Cannot resolve keyword 'name' into field. Choices are: categorie, centredeformation, date_de_crea, id

2023-09-25 Thread Muhammed Lawal
Have you confirmed there is a 'name' field in your CentreCategorie and
Region models?

On Mon, 25 Sep 2023, 5:44 p.m. Baye SALIOU DIAW, <
bayesalioudiawt...@gmail.com> wrote:

> 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
> 
> .
>

-- 
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/CAOzVPC_26jEEARrqmZ%3Dt%2BsLc7LQhJejyXykiNvW%2BBZLGQ%2BQH7A%40mail.gmail.com.