Re: sub-list not showing

2023-03-16 Thread Brian Carey

A quick glance: In your temple for loop you have 'student_set' in the 
conditional and  'students_set' in the loop. That doesn't seem right.

⁣Get BlueMail for Android ​

On Mar 16, 2023, 9:01 PM, at 9:01 PM, nef  wrote:
>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)
 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)

Re: sub-list not showing

2023-03-16 Thread nef
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)
>>> 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 %}
>>>
>>>

Re: sub-list not showing

2023-03-16 Thread Namanya Daniel
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)
>> 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: 

Re: sub-list not showing

2023-03-16 Thread Namanya Daniel
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)
> 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
> 

Re: Testing django

2023-03-16 Thread Ayush Bisht
Yeah, I got you..
My concern is on the documentation, the way it has provided the commands
for executing test cases.

That
path.to.settings seems confusing sometimes..

On Fri, 17 Mar, 2023, 1:20 am Bhuvnesh Sharma, 
wrote:

> We can run django tests with custom settings by using --settings flag and
> providing the path to the custom settings file . For example:
> ./runtests.py --settings=new_app.test_settings
>
> What do you want to do exactly?
>
> On Fri, Mar 17, 2023 at 1:00 AM Ayush Bisht 
> wrote:
>
>> Seems like, it is for defining how actually we are selecting the specific
>> test case. It is very confusing at first.
>> Can't we just explain it with an example..
>>
>> On Friday, March 17, 2023 at 12:54:27 AM UTC+5:30 Ayush Bisht wrote:
>>
>>> * ./runtests.py --settings=path.to.settings i18n.tests.TranslationTests*
>>>
>>> what exactly is the purpose of *path.to.settings,* I'm getting an error
>>> while running the above line.
>>> Can anyone please explain?
>>>
>>> *Error*
>>> Testing against Django installed in '/home/ayush/OS/django/django' with
>>> up to 8 processes
>>> Traceback (most recent call last):
>>>   File "/home/ayush/OS/django/tests/./runtests.py", line 770, in 
>>> failures = django_tests(
>>>   File "/home/ayush/OS/django/tests/./runtests.py", line 398, in
>>> django_tests
>>> test_labels, state = setup_run_tests(*process_setup_args)
>>>   File "/home/ayush/OS/django/tests/./runtests.py", line 300, in
>>> setup_run_tests
>>> test_modules, state = setup_collect_tests(
>>>   File "/home/ayush/OS/django/tests/./runtests.py", line 201, in
>>> setup_collect_tests
>>> "INSTALLED_APPS": settings.INSTALLED_APPS,
>>>   File "/home/ayush/OS/django/django/conf/__init__.py", line 84, in
>>> __getattr__
>>> self._setup(name)
>>>   File "/home/ayush/OS/django/django/conf/__init__.py", line 71, in
>>> _setup
>>> self._wrapped = Settings(settings_module)
>>>   File "/home/ayush/OS/django/django/conf/__init__.py", line 185, in
>>> __init__
>>> mod = importlib.import_module(self.SETTINGS_MODULE)
>>>   File "/usr/lib/python3.10/importlib/__init__.py", line 126, in
>>> import_module
>>> return _bootstrap._gcd_import(name[level:], package, level)
>>>   File "", line 1050, in _gcd_import
>>>   File "", line 1027, in _find_and_load
>>>   File "", line 992, in
>>> _find_and_load_unlocked
>>>   File "", line 241, in
>>> _call_with_frames_removed
>>>   File "", line 1050, in _gcd_import
>>>   File "", line 1027, in _find_and_load
>>>   File "", line 992, in
>>> _find_and_load_unlocked
>>>   File "", line 241, in
>>> _call_with_frames_removed
>>>   File "", line 1050, in _gcd_import
>>>   File "", line 1027, in _find_and_load
>>>   File "", line 1004, in
>>> _find_and_load_unlocked
>>> ModuleNotFoundError: No module named 'path'
>>>
>> --
>> 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/dd827ca8-704e-4ffc-8d7a-2c56d100cdd7n%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/CA%2BZJHEqMWEj8dE9gpVW0f5QajXy1b9GPp-Qur4457GMoWAoUbQ%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/CA%2B%2BM4H5-M%2B6T5PvfctNYJR7o0ebry_4f-JUGec8QewJs%2BhASNg%40mail.gmail.com.


Deleted django_content_type table

2023-03-16 Thread shailesh sachan
Now i am not able to do anything and i cannot lose the data please help 
restore contenttypes

-- 
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/879a1674-05c1-4a53-a89e-aec35309f062n%40googlegroups.com.


Re: Testing django

2023-03-16 Thread Bhuvnesh Sharma
We can run django tests with custom settings by using --settings flag and
providing the path to the custom settings file . For example:
./runtests.py --settings=new_app.test_settings

What do you want to do exactly?

On Fri, Mar 17, 2023 at 1:00 AM Ayush Bisht 
wrote:

> Seems like, it is for defining how actually we are selecting the specific
> test case. It is very confusing at first.
> Can't we just explain it with an example..
>
> On Friday, March 17, 2023 at 12:54:27 AM UTC+5:30 Ayush Bisht wrote:
>
>> * ./runtests.py --settings=path.to.settings i18n.tests.TranslationTests*
>>
>> what exactly is the purpose of *path.to.settings,* I'm getting an error
>> while running the above line.
>> Can anyone please explain?
>>
>> *Error*
>> Testing against Django installed in '/home/ayush/OS/django/django' with
>> up to 8 processes
>> Traceback (most recent call last):
>>   File "/home/ayush/OS/django/tests/./runtests.py", line 770, in 
>> failures = django_tests(
>>   File "/home/ayush/OS/django/tests/./runtests.py", line 398, in
>> django_tests
>> test_labels, state = setup_run_tests(*process_setup_args)
>>   File "/home/ayush/OS/django/tests/./runtests.py", line 300, in
>> setup_run_tests
>> test_modules, state = setup_collect_tests(
>>   File "/home/ayush/OS/django/tests/./runtests.py", line 201, in
>> setup_collect_tests
>> "INSTALLED_APPS": settings.INSTALLED_APPS,
>>   File "/home/ayush/OS/django/django/conf/__init__.py", line 84, in
>> __getattr__
>> self._setup(name)
>>   File "/home/ayush/OS/django/django/conf/__init__.py", line 71, in _setup
>> self._wrapped = Settings(settings_module)
>>   File "/home/ayush/OS/django/django/conf/__init__.py", line 185, in
>> __init__
>> mod = importlib.import_module(self.SETTINGS_MODULE)
>>   File "/usr/lib/python3.10/importlib/__init__.py", line 126, in
>> import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>>   File "", line 1050, in _gcd_import
>>   File "", line 1027, in _find_and_load
>>   File "", line 992, in
>> _find_and_load_unlocked
>>   File "", line 241, in
>> _call_with_frames_removed
>>   File "", line 1050, in _gcd_import
>>   File "", line 1027, in _find_and_load
>>   File "", line 992, in
>> _find_and_load_unlocked
>>   File "", line 241, in
>> _call_with_frames_removed
>>   File "", line 1050, in _gcd_import
>>   File "", line 1027, in _find_and_load
>>   File "", line 1004, in
>> _find_and_load_unlocked
>> ModuleNotFoundError: No module named 'path'
>>
> --
> 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/dd827ca8-704e-4ffc-8d7a-2c56d100cdd7n%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/CA%2BZJHEqMWEj8dE9gpVW0f5QajXy1b9GPp-Qur4457GMoWAoUbQ%40mail.gmail.com.


Re: Testing django

2023-03-16 Thread Ayush Bisht
Seems like, it is for defining how actually we are selecting the specific 
test case. It is very confusing at first. 
Can't we just explain it with an example..

On Friday, March 17, 2023 at 12:54:27 AM UTC+5:30 Ayush Bisht wrote:

> * ./runtests.py --settings=path.to.settings i18n.tests.TranslationTests*
>
> what exactly is the purpose of *path.to.settings,* I'm getting an error 
> while running the above line.
> Can anyone please explain?
>
> *Error*  
> Testing against Django installed in '/home/ayush/OS/django/django' with up 
> to 8 processes
> Traceback (most recent call last):
>   File "/home/ayush/OS/django/tests/./runtests.py", line 770, in 
> failures = django_tests(
>   File "/home/ayush/OS/django/tests/./runtests.py", line 398, in 
> django_tests
> test_labels, state = setup_run_tests(*process_setup_args)
>   File "/home/ayush/OS/django/tests/./runtests.py", line 300, in 
> setup_run_tests
> test_modules, state = setup_collect_tests(
>   File "/home/ayush/OS/django/tests/./runtests.py", line 201, in 
> setup_collect_tests
> "INSTALLED_APPS": settings.INSTALLED_APPS,
>   File "/home/ayush/OS/django/django/conf/__init__.py", line 84, in 
> __getattr__
> self._setup(name)
>   File "/home/ayush/OS/django/django/conf/__init__.py", line 71, in _setup
> self._wrapped = Settings(settings_module)
>   File "/home/ayush/OS/django/django/conf/__init__.py", line 185, in 
> __init__
> mod = importlib.import_module(self.SETTINGS_MODULE)
>   File "/usr/lib/python3.10/importlib/__init__.py", line 126, in 
> import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1050, in _gcd_import
>   File "", line 1027, in _find_and_load
>   File "", line 992, in 
> _find_and_load_unlocked
>   File "", line 241, in 
> _call_with_frames_removed
>   File "", line 1050, in _gcd_import
>   File "", line 1027, in _find_and_load
>   File "", line 992, in 
> _find_and_load_unlocked
>   File "", line 241, in 
> _call_with_frames_removed
>   File "", line 1050, in _gcd_import
>   File "", line 1027, in _find_and_load
>   File "", line 1004, in 
> _find_and_load_unlocked
> ModuleNotFoundError: No module named 'path'
>

-- 
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/dd827ca8-704e-4ffc-8d7a-2c56d100cdd7n%40googlegroups.com.


Testing django

2023-03-16 Thread Ayush Bisht
* ./runtests.py --settings=path.to.settings i18n.tests.TranslationTests*

what exactly is the purpose of *path.to.settings,* I'm getting an error 
while running the above line.
Can anyone please explain?

*Error*  
Testing against Django installed in '/home/ayush/OS/django/django' with up 
to 8 processes
Traceback (most recent call last):
  File "/home/ayush/OS/django/tests/./runtests.py", line 770, in 
failures = django_tests(
  File "/home/ayush/OS/django/tests/./runtests.py", line 398, in 
django_tests
test_labels, state = setup_run_tests(*process_setup_args)
  File "/home/ayush/OS/django/tests/./runtests.py", line 300, in 
setup_run_tests
test_modules, state = setup_collect_tests(
  File "/home/ayush/OS/django/tests/./runtests.py", line 201, in 
setup_collect_tests
"INSTALLED_APPS": settings.INSTALLED_APPS,
  File "/home/ayush/OS/django/django/conf/__init__.py", line 84, in 
__getattr__
self._setup(name)
  File "/home/ayush/OS/django/django/conf/__init__.py", line 71, in _setup
self._wrapped = Settings(settings_module)
  File "/home/ayush/OS/django/django/conf/__init__.py", line 185, in 
__init__
mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1050, in _gcd_import
  File "", line 1027, in _find_and_load
  File "", line 992, in _find_and_load_unlocked
  File "", line 241, in 
_call_with_frames_removed
  File "", line 1050, in _gcd_import
  File "", line 1027, in _find_and_load
  File "", line 992, in _find_and_load_unlocked
  File "", line 241, in 
_call_with_frames_removed
  File "", line 1050, in _gcd_import
  File "", line 1027, in _find_and_load
  File "", line 1004, in 
_find_and_load_unlocked
ModuleNotFoundError: No module named 'path'

-- 
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/f3d46fc7-0b31-4f28-844a-16462982a439n%40googlegroups.com.


sub-list not showing

2023-03-16 Thread nef
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