Hello ,

I found this tutorial:

https://dboostme.medium.com/using-django-with-multiple-databases-introduction-8f0ffb409995

But i self don't use several databases

Regards

Muhammad Juwaini Abdul Rahman <[email protected]> schrieb am Mi., 26. Juli
2023, 05:11:

> Hi all,
>
> I have two different databases as below:
>
> DATABASES = {
> 'tvet': {
> 'ENGINE': 'django.db.backends.sqlite3',
> 'NAME': BASE_DIR / 'db.sqlite3',
> },
> 'default': {
> 'ENGINE': 'django.db.backends.mysql',
> 'NAME': 'jpk',
> 'USER': 'jpkuser',
> 'PASSWORD': 'jpkpassword',
> 'HOST': 'localhost', # Or an IP Address that your DB is hosted on
> 'PORT': '3306',
> }
> }
>
> When I want to create a CreateView, I am unable to save it.
>
> This is my CreateView:
>
> class BiodataCreateView(CreateView):
> template_name = 'bio_create.html'
>
> # model = Biodata.objects.using('tvet').all()
> def get_queryset(self):
> return Biodata.objects.using('tvet').all()
>
> fields = 'name', 'hobby'
>
> def get_success_url(self):
> return reverse('biodata-list')
>
> Any idea on how to do it?
>
> --
> 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/4985efd7-437c-432e-86c8-9a902430513fn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4985efd7-437c-432e-86c8-9a902430513fn%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/CAKGT9mx3fko1dW%3Dk41975xgrD%3D6sj6p45HewtibW0fdwKNBVcw%40mail.gmail.com.

Reply via email to