Re: Migration of tables from external database to new database
Hi, My suggestion is to first create the apps using Django, then create the models respecting the database structure you are willing to migrate, run the makemigrations, migrate which will create a new database with tables having the same structure as those you want to migrate. After that, use the phpmyAdmin or what other tools you have to migrate your data from the old database to the new database I hope it helps. Thanks Nef On Monday, 20 March 2023 at 23:19:35 UTC+3 Adekola Aderonmu wrote: > Hi, my engine is mysql > Yes, there is data in the table I want to migrate into the new database. > > CUS THE DATABASE I WANT TO MIGRATE TOO IS AN APP IN DJANGO > > On Mon, 20 Mar 2023, 20:20 nef, wrote: > >> Hi Adekola, >> Can you provide more details? >> Which database engine are you using? Version? Is your table have data or >> do you want to migrate the structure...? >> How this is related to Django? >> Thanks >> >> On Monday, 20 March 2023 at 08:12:20 UTC+1 Adekola Aderonmu wrote: >> >>> Hi guys, >>> I have an external database with a particular table, and I want this >>> table to be on my new database. How do I go about the migration of the >>> table from the external database into the new database? >>> >>> THANK YOU >>> >> -- >> 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/4c726045-a3d5-4667-ad7e-1e732085f922n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/4c726045-a3d5-4667-ad7e-1e732085f922n%40googlegroups.com?utm_medium=email_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/29e8f010-569e-43e5-8280-88005fc4863cn%40googlegroups.com.
Re: Migration of tables from external database to new database
Hi Adekola, Can you provide more details? Which database engine are you using? Version? Is your table have data or do you want to migrate the structure...? How this is related to Django? Thanks On Monday, 20 March 2023 at 08:12:20 UTC+1 Adekola Aderonmu wrote: > Hi guys, > I have an external database with a particular table, and I want this > table to be on my new database. How do I go about the migration of the > table from the external database into the new database? > > THANK YOU > -- 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/4c726045-a3d5-4667-ad7e-1e732085f922n%40googlegroups.com.
Re: sub-list not showing
I just solve the issue by modifying the view.py like this def parentsDetails(request, pk): parentObj = Parents.objects.get(parent_id=pk) std = Student.objects.filter(std_parents = parentObj.parent_id) # std = parentObj.student_set.all() context = {'parentObj': parentObj, 'std': std} # context = {'parentObj': parentObj} return render(request, "students_management_app/parents-single.html", context) Thanks to all for your support On Saturday, 18 March 2023 at 13:36:50 UTC+1 nef wrote: > Thanks to all of you for your feedback. > I am trying the 2 suggestions, but none of it works. > For the use of the uuid in the view, here is the code: > def parentsDetails(request, pk): > parentObj = Parents.objects.get(parent_id=pk) > std = Student.objects.filter(student_id = Parents.parent_id) > context = {'parentObj': parentObj, 'std': std} > # context = {'parentObj': parentObj} > return render(request, "students_management_app/parents-single.html", > context) > Here is the template: >{% if std %} > {% for student in std %} > > List of students > {{student.std_matricule}} > {{student.std_firstname}} {{student.std_midlename}} > {{student.std_surname}} > {{student.std_sex}} > > {% endfor %} > {% endif %} > No Student found in the database > I an having this error > ValidationError at > /parentsDetails/321a4f9c-0ffb-4759-9155-b489dd32ad18/['“ > object at 0x025FFDF3D600>” is not a valid UUID.'] > Please help. > Thanks > NEF > On Friday, 17 March 2023 at 09:02:21 UTC+1 Sandip Bhattacharya wrote: > >> >> >> On Mar 16, 2023, at 2:22 PM, nef wrote: >> >> class Student(models.Model): >> #std_matricule = models.CharField(verbose_name='Student matricule', >> max_length=6, null=False, unique=True, primary_key=True) >> std_matricule = models.CharField(verbose_name='Matricule', unique= >> True, max_length=16, null=False, blank=False, help_text='Matricule of >> the student') >> std_parents = models.ForeignKey(Parents, on_delete=models.DO_NOTHING, >> related_name='Parents', unique=False, null=True, blank=True, verbose_name >> ='Student parents') >> >> >> I believe that the “related_name” parameter to ForeignKey is the name of >> the set of THIS model(Student) in the foreign table(Parents). So it should >> be, “students”, not “Parents”. >> >> Only then will a parent object refer to the set of students related to it >> by that name. e.g. parent.students. >> >> This was a point of confusion for me when I read this the first time as >> well. >> >> >> https://docs.djangoproject.com/en/4.1/topics/db/queries/#backwards-related-objects >> >> >> Thanks, >> Sandip >> >> >> -- 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/2c59709f-b6b4-4a03-bb96-60c8989e9dc9n%40googlegroups.com.
Re: sub-list not showing
Hi Daniel, Thanks for your feedback. Please, is there anyone who can help me on how to do it? Thank you On Thursday, 16 March 2023 at 22:01:53 UTC+1 Namanya Daniel wrote: > You need to achieve related fields to achieve the most of this… thank you > > On Thu, 16 Mar 2023 at 23:59, Namanya Daniel wrote: > >> Hello… am using a phone to reply this but I would love to give a hint on >> something. When you have a child, it’s means there’s a parent foreign key >> in the child model. You can use grouper to group child model results so >> that every is grouped together under a particular parent field. >> >> On Thu, 16 Mar 2023 at 21:22, nef wrote: >> >>> Hi all, >>> I am facing problem to display a sub-list. >>> In my model, I ahave a Student and Parent models. A prent can have one >>> or more students. >>> I want to list all the student in the parent page, but it is not >>> showing. >>> Please see here my code. >>> Models >>> >>> class Student(models.Model): >>> #std_matricule = models.CharField(verbose_name='Student matricule', >>> max_length=6, null=False, unique=True, primary_key=True) >>> std_matricule = models.CharField(verbose_name='Matricule', unique= >>> True, max_length=16, null=False, blank=False, help_text='Matricule of >>> the student') >>> std_parents = models.ForeignKey(Parents, on_delete=models.DO_NOTHING, >>> related_name='Parents', unique=False, null=True, blank=True, >>> verbose_name='Student parents') >>> std_email = models.EmailField(verbose_name='Email', null=False, >>> blank=True, help_text='Enter the email of the student or leave blank if >>> not exist') >>> std_password = models.CharField(verbose_name='Password', max_length= >>> 512, null=False, blank=True, help_text='Type the password with 6 >>> characters minimum') >>> std_surname = models.CharField(verbose_name='Surname', null=False, >>> blank=False, max_length=128, help_text='Type the Surname of the student >>> as in the birth certificate') >>> std_firstname = models.CharField(verbose_name='First name', null= >>> False, blank=True, max_length=128, help_text='Type the student first >>> name') >>> std_midlename = models.CharField(verbose_name='Midle name', null= >>> False, blank=True, max_length=128, help_text='Type the student first >>> name') >>> std_nickname = models.CharField(verbose_name='Student Nickname', >>> max_length=64, null=False, blank=True, help_text='If exist, type >>> student nickname here') >>> >>> lass Parents(models.Model): >>> father_surname = models.CharField(verbose_name='Father surname', >>> max_length=128, null=False, blank=True, help_text='Student Father >>> surname as in the birth certificate') >>> father_firstName = models.CharField(verbose_name='Father name', >>> max_length=128, null=False, blank=True) >>> father_phone = models.CharField(verbose_name='Father phone number', >>> max_length=24, null=False, blank=True, help_text='Phone number of the >>> Father') >>> father_dateOfBirth = models.DateField(verbose_name='Father date of >>> birth', null=True, blank=True) >>> father_placeOfBirth = models.CharField(verbose_name='Father place >>> of birth', max_length=512, null=True, blank=True) >>> father_nationality = models.CharField('Father nationality', >>> max_length=256, null=False, blank=True) >>> father_adress = models.CharField(verbose_name='Father resident >>> adress', max_length=512, null=False, blank=True) >>> father_occupation = models.CharField(verbose_name='Father >>> occupation', max_length=512, null=False, blank=True) >>> mother_surname = models.CharField(verbose_name='Mother surname', >>> null=False, max_length=128, help_text='Student Father name as in the >>> birth certificate') >>> mother_firstName = models.CharField(verbose_name='Mother name', >>> max_length=128, null=False, blank=True) >>> mother_phone = models.CharField(verbose_name='Mother phone number', >>> max_length=64, null=False, blank=True, help_text='Phone number of the >>> mother') >>> mother_dateOfBirth = models.DateField(verbose_name='Mother date of >>> birth', null=True, blank=True) >>> mother_placeOfBirth = models.CharField(verbose_name='Mother place >>> of birth', max_length=512, null=False, blank=True) >>> moth
sub-list not showing
Hi all, I am facing problem to display a sub-list. In my model, I ahave a Student and Parent models. A prent can have one or more students. I want to list all the student in the parent page, but it is not showing. Please see here my code. Models class Student(models.Model): #std_matricule = models.CharField(verbose_name='Student matricule', max_length=6, null=False, unique=True, primary_key=True) std_matricule = models.CharField(verbose_name='Matricule', unique=True, max_length=16, null=False, blank=False, help_text='Matricule of the student' ) std_parents = models.ForeignKey(Parents, on_delete=models.DO_NOTHING, related_name='Parents', unique=False, null=True, blank=True, verbose_name='Student parents') std_email = models.EmailField(verbose_name='Email', null=False, blank= True, help_text='Enter the email of the student or leave blank if not exist' ) std_password = models.CharField(verbose_name='Password', max_length=512, null=False, blank=True, help_text='Type the password with 6 characters minimum') std_surname = models.CharField(verbose_name='Surname', null=False, blank =False, max_length=128, help_text='Type the Surname of the student as in the birth certificate') std_firstname = models.CharField(verbose_name='First name', null=False, blank=True, max_length=128, help_text='Type the student first name') std_midlename = models.CharField(verbose_name='Midle name', null=False, blank=True, max_length=128, help_text='Type the student first name') std_nickname = models.CharField(verbose_name='Student Nickname', max_length=64, null=False, blank=True, help_text='If exist, type student nickname here') lass Parents(models.Model): father_surname = models.CharField(verbose_name='Father surname', max_length=128, null=False, blank=True, help_text='Student Father surname as in the birth certificate') father_firstName = models.CharField(verbose_name='Father name', max_length=128, null=False, blank=True) father_phone = models.CharField(verbose_name='Father phone number', max_length=24, null=False, blank=True, help_text='Phone number of the Father') father_dateOfBirth = models.DateField(verbose_name='Father date of birth', null=True, blank=True) father_placeOfBirth = models.CharField(verbose_name='Father place of birth', max_length=512, null=True, blank=True) father_nationality = models.CharField('Father nationality', max_length= 256, null=False, blank=True) father_adress = models.CharField(verbose_name='Father resident adress', max_length=512, null=False, blank=True) father_occupation = models.CharField(verbose_name='Father occupation', max_length=512, null=False, blank=True) mother_surname = models.CharField(verbose_name='Mother surname', null= False, max_length=128, help_text='Student Father name as in the birth certificate') mother_firstName = models.CharField(verbose_name='Mother name', max_length=128, null=False, blank=True) mother_phone = models.CharField(verbose_name='Mother phone number', max_length=64, null=False, blank=True, help_text='Phone number of the mother') mother_dateOfBirth = models.DateField(verbose_name='Mother date of birth', null=True, blank=True) mother_placeOfBirth = models.CharField(verbose_name='Mother place of birth', max_length=512, null=False, blank=True) mother_nationality = models.CharField('Mother nationality', max_length= 512, null=False, blank=True) mother_adress = models.CharField(verbose_name='Mother resident adress', max_length=512, null=False, blank=True) mother_occupation = models.CharField(verbose_name='Mother occupation', max_length=512, null=False, blank=True) View def parentsDetails(request, pk): parentObj = Parents.objects.get(parent_id=pk) context = {'parentObj': parentObj} return render(request, "students_management_app/parents-single.html", context) Template {% extends 'main.html' %} {% block content %} A parent page for more details {{parentObj.std_matricule}} Father full name: {{parentObj.father_firstName}} {{parentObj.father_surname}} Mother full name: {{parentObj.mother_firstName}} {{parentObj.mother_surname}} Register date: {{parentObj.parent_createDate}} Add parents {% if parentObj.student_set.all %} {% for student in parentObj.students_set.all %} List of students {{student.std_matricule}} {{student.std_firstname}} {{student.std_midlename}} {{student.std_surname}} {{student.std_sex}} {% endfor %} {% endif %} No Student found in the database {% endblock content %} Footer The page is displaying well with all the information for the parent, but not student data. Thank you Eric -- You received this message because you are
Not able to save data from a form Django 4.1
Hi everyone, I am working on a small student application. I designed a table for storing students' information in which those fields of information are requested at the first registration and those can be updated later or updated during the process. For example, a student's information can update in the process by putting on-hold (update the onhold field) in case that student has been absent for 3 weeks. The attached file contains my code. When I fill out the form and submit it, it opens a new form without safe my information. I also try to create the form directly from the model and send it, but it still not working (saying that there is a mandatory field even when I filled all the fields) ###form.py class StudentRegistrationForm(ModelForm): class Meta: model = Student fields = "__all__" ###view.py def addStudent(request): form = StudentRegistrationForm() if request.method == "POST": form = StudentRegistrationForm(request.POST) if form.is_valid(): form.save() return redirect('listStudents') return render(request, 'students_management_app/student_template/addStudent.html', {'form': form}) Thank you for your support Eric -- 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/9c527bc5-bfc1-4f97-bb55-4e6c82350d80n%40googlegroups.com. ###Model.py from django.db import models from django.contrib import admin from django.utils.translation import gettext_lazy as _ class Student(models.Model): #std_matricule = models.CharField(verbose_name='Student matricule', max_length=6, null=False, unique=True, primary_key=True) std_matricule = models.CharField(verbose_name='Matricule', max_length=6, null=False, unique=True, blank=False, help_text='Matricule of the student') std_parents = models.ForeignKey(Parents, on_delete=models.DO_NOTHING, related_name='Parents', unique=False, default=1, verbose_name='Student parents') std_email = models.EmailField(verbose_name='Email', null=False, blank=True, help_text='Enter the email of the student or leave blank if not exist') std_password = models.CharField(verbose_name='Password', max_length=64, null=False, blank=True, help_text='Type the password with 6 characters minimum') std_surname = models.CharField(verbose_name='Surname', null=False, blank=False, max_length=64, help_text='Type the Surname of the student as in the birth certificate') std_firstname = models.CharField(verbose_name='First name', null=False, blank=True, max_length=64, help_text='Type the student first name') std_nickname = models.CharField(verbose_name='Student Nickname', max_length=64, null=False, blank=True, help_text='If exist, type student nickname here') class Sex(models.TextChoices): MALE = 'Male', _('Male') FEMALE = 'Female', _('Female') std_sex = models.CharField( max_length=8, choices=Sex.choices, default=Sex.MALE, verbose_name='Sex', help_text='Select the sex from the dropdown list', ) std_dateOfBirth = models.DateField(verbose_name='Date of birth', null=False, blank=False, help_text='Birth date of the student as in the birth certificate') std_placeOfBirth = models.CharField(verbose_name='Place of birth', max_length=64, null=False, blank=False, help_text='Place of birth of the student as in the birth certificate') std_countryOfBirth = models.CharField(verbose_name='Country of birth', max_length=64, null=True, blank=True, help_text='Country of birth of the student as in the birth certificate') std_nationality = models.CharField(verbose_name='Student nationality', max_length=64, null=True, blank=True, help_text='Nationality of the student') std_adress = models.CharField(verbose_name='Student adress', max_length=256, null=False, blank=True) std_phoneNumber = models.CharField(verbose_name='Student phone number', max_length=32, null=False, blank=True, help_text='Student phone number') std_enrolmentDate = models.DateField(verbose_name='Student enrolment date', null=False, blank=False, help_text='Enter the enrolment date') std_photo = models.ImageField(verbose_name='Student photo', null=False, help_text='Please, upload a recent photo of the student') std_birthCertificate = models.FileField('Student birth certificate scann', null=False, blank=True, help_text='Upload a readable scan copy of the birth certificate here') std_otherDocs = models.FileField('Student others documents', null=False, blank=True, help_text='If exist, upload those support documents') class STD_status(models.TextChoices): ACTIF = 'Active', _('Active') INACTIF = 'Inactive', _('Inactive') ONHOLD = 'Onhold',
Looking for available support to start a School Management Application
Hi everyone, I am beginer in Django, not much experience. I have been task to develop an application for school management (Admission, Registration, Attendance, Report marks, and more functions). I am wondering if there is an existing open smilare app or something which can be use as baseline to start or guide me with best practices. Thank you Eric -- 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/176ec5a0-2e00-4f53-b5c3-1bfc72f3aa94n%40googlegroups.com.
Release 1.11.16 on hold?
Hi everyone, Does someone know what has happened with the release 1.11.16 with ETA 1st of September? It seems the bugfix for "Race condition in QuerySet.update_or_create() that could result in data loss" has already been closed... https://docs.djangoproject.com/en/1.11/releases/1.11.16/ Thank you, Nef -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7d9f9a74-4e0a-45e6-be2d-93b3fdde96a8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Problem to complète the xml template
Hello, Thank you for your help. I have solved my problem. As I did not need a loop because there is just an object. My mistake was at my query that did not return objects. Thank you for your response On Thursday, July 5, 2012 7:42:06 AM UTC, JirkaV wrote: > > > Hello, > > http://cdm-fr.fr/2006/schemas/CDM-fr.xsd; language="fr-FR"> > > {% if formations %} > > > > > > Hi there, > >you probably want to follow your {% if formations %} statement with: > {% for formation in formations %} > > Check Django template documentation again - you're moving along the > right path, but your template is missing the loop across individual > formations. > > HTH > >Jirka > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/xS4EiBSaJvQJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Problem to complète the xml template
Hello, I want to cry a function allowing me to complete a template *. Xml. May I have a problem with the passage of the object render_to_response. In short here is my code. In fact, I do not know how to return an object that can permattre me to complete my template automatically. I am using django 1.1 and Python 2.6 Function writes to the file views.py def main_formation(request, formation_id): formations = Formation.objects.get(id=formation_id) variables = RequestContext(request, { 'formations': formations }) return render_to_response('saisie/formation.xml', variables) This is mu xml template http://cdm-fr.fr/2006/CDM-frSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://cdm-fr.fr/2006/CDM-frSchema http://cdm-fr.fr/2006/schemas/CDM-fr.xsd; language="fr-FR"> {% if formations %} {{ formation.ville }} {{ formation.pays }} {% endif %} Thanks for your help. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/U_4GarjysOgJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Use django and xml to communicate whith ORI-OAI
Hello, I am working with django and I have a medium level. I want to use xml to interchange data with an application that already exists. This application is ORI-OAI. This is an application that advertises the information in the field of education, especially in France. Only I do not know yet used xml with django. I would like a link or a tutorial for me to start. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/nXb63Ko77W0J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.