Re: NO IDEA

2022-08-01 Thread Opeyemi Ogunsanya
You said how can you filter by year and I gave you an idea on how to
go about it. Next thing I get is if you are a newbie in Django don't show
us that you know,  what is wrong with  Nigerian.

On Tue, Aug 2, 2022, 5:15 AM kateregga julius 
wrote:

> Boss if you are a newbie in Django don't show us that you know..
> Do not reply on my threads
> Is the comment or query you wrote possible?
> I don't know what is wrong with Nigerian
>

-- 
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/CABJxPrHyh0cr45j50odfJDNhk6JoZoM%2BfrwwGc0937V%3D5DO-dQ%40mail.gmail.com.


Re: 如何在Django4.0.6中使用MongoDB数据库

2022-08-01 Thread Hella thor
Thank you.  I'm already on board.

Satyajit Barik  于2022年8月1日周一 22:26写道:

> I am delighted to invite you on behalf of python & django to become a free
> member today in WhatsApp group.
>
>
> Here you can join in our WhatsApp group using below link
>
> 
>
> https://chat.whatsapp.com/Bq2jcxLJVG50v9Wbkvz6Vy
>
>
> [Membership benefits] Here are some great perks you get for becoming a
> member:
>
>- Ask your python & django related problems: get quick possible answer.
>- Friendly environment: you can learn python & django from core.
>- Daily Python Assignment exercise.
>
>
> Thank you for your consideration, I look forward to hearing from you and
> hope to see you at our WhatsApp python group.
>
>
>
>
>
> On Wed, 20 Jul 2022 at 8:18 AM, Hella thor 
> wrote:
>
>> Hi guys
>> 我查询了很多的资料,发现Django无法很好的连接MongoDB(该数据库在其他的服务器中),我需要解决如下问题:
>>
>> 1、在settings.py文件中设置连接MongoDB,需要密码
>> 2、在models.py文件中建立模型
>> 3、在views.py中进行数据的读写操作
>>
>> 我尝试了在python中进行连接,但是我不知道如何在Django中进行连接MongoDB,以下是我的环境配置信息:
>>
>> python==3.9.0
>> django==4.0.6
>> pymongo==4.1.1
>> mongoengine==0.24.1
>>
>> DATABASE
>> [image: 0220720104558.png]
>>
>> 如果您帮我,我将对您万分感谢。
>>
>> --
>> 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/36c0e6d2-93aa-4a10-86ba-1de35a9b5e43n%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/CANd-%2BoAuebSZ9hukOtoBh1qTCPH-Zj-F1cg8YCpO6Nt0ihbstA%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/CAAE1PWyz%2Bbt6cGFmcr5KkXixYLa1v5MA9Exw%2BvmjNHu7DC00Zw%40mail.gmail.com.


Re: 如何在Django4.0.6中使用MongoDB数据库

2022-08-01 Thread Hella thor
Thank you Buddy.
I've taken care of it.
Have a nice day.
Thank you aggin.

Juergen Hauser  于2022年8月1日周一 06:23写道:

> pip install djongo
> pip install pytz
> pip install pymongo==3.12.3
>
> settings.py:
>
> import djongo
>
> #Database is localhost:
> DATABASES = {
> 'default': {
> 'ENGINE': 'djongo',
> 'NAME': 'your-db-name',
> 'ENFORCE_SCHEMA': False
> }
> }
>
> #Database is server:
> DATABASES = {
>  'default': {
>  'ENGINE': 'djongo',
>  'NAME': 'your-db-name',
> 'ENFORCE_SCHEMA': False,
>  'CLIENT': {
> 'host': 'host-name or ip address',
> 'port': port_number, 'username': 'db-username',
>  'password': 'password',
> 'authSource': 'db-name',
>  'authMechanism': 'SCRAM-SHA-1'
>  },
> 'LOGGING': {
> 'version': 1,
> 'loggers': {
>  'djongo': {
> 'level': 'DEBUG',
>  'propagate': False,
>  }
>  },
> },
>  }
> }
>
>
> Django Terminal:
>
> python  manage.py makemigrations
>
> python  manage.py migrate
>
>
> hellatho...@gmail.com schrieb am Dienstag, 19. Juli 2022 um 21:47:26
> UTC-5:
>
>> Hi guys
>> 我查询了很多的资料,发现Django无法很好的连接MongoDB(该数据库在其他的服务器中),我需要解决如下问题:
>>
>> 1、在settings.py文件中设置连接MongoDB,需要密码
>> 2、在models.py文件中建立模型
>> 3、在views.py中进行数据的读写操作
>>
>> 我尝试了在python中进行连接,但是我不知道如何在Django中进行连接MongoDB,以下是我的环境配置信息:
>>
>> python==3.9.0
>> django==4.0.6
>> pymongo==4.1.1
>> mongoengine==0.24.1
>>
>> DATABASE
>> [image: 0220720104558.png]
>>
>> 如果您帮我,我将对您万分感谢。
>>
> --
> 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/30443d79-678d-4312-8c44-1bdf3eee5c1dn%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/CAAE1PWx5Ez0RPvJQS5gzmhCjfxMK2_%3D9nmiu7dke-ed2hMzPcg%40mail.gmail.com.


Re: Hi guys how to run pyscript on local webserver without using cdn ljnk

2022-08-01 Thread Abdul Qoyyuum
Download it from https://pyscript.net/ and load it on your local webserver.

On Fri, Jul 29, 2022 at 10:59 PM Ad Tariq  wrote:

>
>
> Sent from my Huawei Mobile
>
> --
> 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/6ywask-egl8ube6tn3j-gnugz6tq5tn5-981h8o-fbbyrfs04g4p-dy72o68w852c9bhuw0fdasxpttm02p-njks7934b8sl-h99obj3i1f0vq63om8-okzqxt-kcl72n-o861ua-tut0wbuki823ym9cfl.1659106691758%40email.android.com
> .
>


-- 
Abdul Qoyyuum Bin Haji Abdul Kadir
HP No: +673 720 8043

-- 
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/CAA3DN%3DXEogAC9pMHaig_%2B-XK%3DkwmFPYr2LxFzSXo6beYJbQf-g%40mail.gmail.com.


Re: GETTING AVERAGE OF A STUDENT IN DIFFERENT YEARS

2022-08-01 Thread Opeyemi Ogunsanya
results=Grade.objects.filter(person=obj,
year=year-to-select-from).aggregate(Avg("mark"))

On Mon, Aug 1, 2022, 10:29 PM kateregga julius 
wrote:

> If I manually pass in the year_id it works.
> My Question is how can I pass the year ID as the third parameter in the
> method of Average
>
> On Mon, 1 Aug 2022, 23:15 kateregga julius, 
> wrote:
>
>> how boss
>>
>>
>> On Mon, Aug 1, 2022 at 8:18 PM Opeyemi Ogunsanya <
>> ogunsanyaopeye...@gmail.com> wrote:
>>
>>> You have to add a year filter in the results query line.
>>> results=Grade.objects.filter(person=obj).aggregate(Avg("mark"))
>>>
>>> On Mon, Aug 1, 2022, 3:09 PM kateregga julius 
>>> wrote:
>>>
 Hello Friends, i have the following models

 =
 class Person(models.Model):
 fname=models.CharField(verbose_name="First Name",max_length=20,blank=
 False)
 lname = models.CharField(verbose_name="Last Name", max_length=20, blank
 =False)
 class Meta:
 ordering =('id','fname','lname')
 verbose_name="Person"
 verbose_name_plural="Person"
 def __str__(self):
 return self.fname +" "+self.lname

 class Year (models.Model):
 year = models.PositiveIntegerField(verbose_name="Year",unique=True )

 class Meta:
 verbose_name = "Year"
 verbose_name_plural = "Year"


 def __str__(self):
 return str(self.year)

 class Courses (models.Model):
 course = models.CharField(verbose_name="Course", max_length=20, blank=
 False,unique=True)
 year = models.ForeignKey(Year,verbose_name="Year",on_delete
 =models.SET_NULL,null=True )

 class Meta:
 ordering = ('id', 'course','year')
 verbose_name = "Coures"
 verbose_name_plural = "Coures"

 def __str__(self):
 return str(self.course)

 class PersonCourse(models.Model):
 person = models.ForeignKey(Person, verbose_name="Person", on_delete
 =models.SET_NULL,null=True)
 course = models.ForeignKey(Courses,verbose_name="Course",on_delete
 =models.SET_NULL,null=True)
 year = models.ForeignKey(Year, verbose_name="Year", 
 on_delete=models.SET_NULL,
 null=True)

 class Meta:
 ordering = ('id', 'person','course')
 verbose_name = "PersonCourse"
 verbose_name_plural = "PersonCourse"

 def __str__(self):
 return self.person.lname +" "+self.person.lname
 class Grade(models.Model):
 person = models.ForeignKey(Person, verbose_name="Person", on_delete
 =models.SET_NULL,null=True)
 course = models.ForeignKey(Courses,verbose_name="Course",on_delete
 =models.SET_NULL,null=True)
 year = models.ForeignKey(Year, verbose_name="Year", 
 on_delete=models.SET_NULL,
 null=True)
 mark=models.PositiveIntegerField(verbose_name="Marks" )
 class Meta:
 ordering = ('id', 'person','course')
 verbose_name = "Grade"
 verbose_name_plural = "Grade"

 def __str__(self):
 return self.person.lname +" "+self.person.lname +" "+self.course.course

 = function ==
 def Average(self,obj):
 results=Grade.objects.filter(person=obj).aggregate(Avg("mark"))
 return results['mark__avg']
 Average.short_description="Average"

 
 if i run the function it returns the average of all the subjects in the
 different year.
 However i want it only to get the overage for a student in a separate
 year

 --
 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/9b9fb098-e560-4ace-8157-596a83d601b6n%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/CABJxPrGTH5DHHMw4oKVRizTr73%2BOgZ6n1%3DCkxbwDbYHuWLc8PQ%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
> 

Re: GETTING AVERAGE OF A STUDENT IN DIFFERENT YEARS

2022-08-01 Thread kateregga julius
If I manually pass in the year_id it works.
My Question is how can I pass the year ID as the third parameter in the
method of Average

On Mon, 1 Aug 2022, 23:15 kateregga julius,  wrote:

> how boss
>
>
> On Mon, Aug 1, 2022 at 8:18 PM Opeyemi Ogunsanya <
> ogunsanyaopeye...@gmail.com> wrote:
>
>> You have to add a year filter in the results query line.
>> results=Grade.objects.filter(person=obj).aggregate(Avg("mark"))
>>
>> On Mon, Aug 1, 2022, 3:09 PM kateregga julius 
>> wrote:
>>
>>> Hello Friends, i have the following models
>>>
>>> =
>>> class Person(models.Model):
>>> fname=models.CharField(verbose_name="First Name",max_length=20,blank=
>>> False)
>>> lname = models.CharField(verbose_name="Last Name", max_length=20, blank=
>>> False)
>>> class Meta:
>>> ordering =('id','fname','lname')
>>> verbose_name="Person"
>>> verbose_name_plural="Person"
>>> def __str__(self):
>>> return self.fname +" "+self.lname
>>>
>>> class Year (models.Model):
>>> year = models.PositiveIntegerField(verbose_name="Year",unique=True )
>>>
>>> class Meta:
>>> verbose_name = "Year"
>>> verbose_name_plural = "Year"
>>>
>>>
>>> def __str__(self):
>>> return str(self.year)
>>>
>>> class Courses (models.Model):
>>> course = models.CharField(verbose_name="Course", max_length=20, blank=
>>> False,unique=True)
>>> year = models.ForeignKey(Year,verbose_name="Year",on_delete
>>> =models.SET_NULL,null=True )
>>>
>>> class Meta:
>>> ordering = ('id', 'course','year')
>>> verbose_name = "Coures"
>>> verbose_name_plural = "Coures"
>>>
>>> def __str__(self):
>>> return str(self.course)
>>>
>>> class PersonCourse(models.Model):
>>> person = models.ForeignKey(Person, verbose_name="Person", on_delete
>>> =models.SET_NULL,null=True)
>>> course = models.ForeignKey(Courses,verbose_name="Course",on_delete
>>> =models.SET_NULL,null=True)
>>> year = models.ForeignKey(Year, verbose_name="Year", 
>>> on_delete=models.SET_NULL,
>>> null=True)
>>>
>>> class Meta:
>>> ordering = ('id', 'person','course')
>>> verbose_name = "PersonCourse"
>>> verbose_name_plural = "PersonCourse"
>>>
>>> def __str__(self):
>>> return self.person.lname +" "+self.person.lname
>>> class Grade(models.Model):
>>> person = models.ForeignKey(Person, verbose_name="Person", on_delete
>>> =models.SET_NULL,null=True)
>>> course = models.ForeignKey(Courses,verbose_name="Course",on_delete
>>> =models.SET_NULL,null=True)
>>> year = models.ForeignKey(Year, verbose_name="Year", 
>>> on_delete=models.SET_NULL,
>>> null=True)
>>> mark=models.PositiveIntegerField(verbose_name="Marks" )
>>> class Meta:
>>> ordering = ('id', 'person','course')
>>> verbose_name = "Grade"
>>> verbose_name_plural = "Grade"
>>>
>>> def __str__(self):
>>> return self.person.lname +" "+self.person.lname +" "+self.course.course
>>>
>>> = function ==
>>> def Average(self,obj):
>>> results=Grade.objects.filter(person=obj).aggregate(Avg("mark"))
>>> return results['mark__avg']
>>> Average.short_description="Average"
>>>
>>> 
>>> if i run the function it returns the average of all the subjects in the
>>> different year.
>>> However i want it only to get the overage for a student in a separate
>>> year
>>>
>>> --
>>> 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/9b9fb098-e560-4ace-8157-596a83d601b6n%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/CABJxPrGTH5DHHMw4oKVRizTr73%2BOgZ6n1%3DCkxbwDbYHuWLc8PQ%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/CAMVv_-GUyey0jE2i6ANWSc%2BUR2gUSNRmKW73gUeEduP7dgMtuw%40mail.gmail.com.


Generating Calendar files for iPhone and Android with Pthon3/django

2022-08-01 Thread lone...@gmail.com
Hello all,

 I want to generate calendar files for both Android and iPhone.  I do 
not want to connect to the Google or Apple APIs to do this.  I just want 
static files that are downloaded from my webapp to the mobile device.  How 
and can this be done?

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/b88bf3da-a699-484e-84dd-61fb929e4e8dn%40googlegroups.com.


Re: GETTING AVERAGE OF A STUDENT IN DIFFERENT YEARS

2022-08-01 Thread kateregga julius
how boss


On Mon, Aug 1, 2022 at 8:18 PM Opeyemi Ogunsanya <
ogunsanyaopeye...@gmail.com> wrote:

> You have to add a year filter in the results query line.
> results=Grade.objects.filter(person=obj).aggregate(Avg("mark"))
>
> On Mon, Aug 1, 2022, 3:09 PM kateregga julius 
> wrote:
>
>> Hello Friends, i have the following models
>>
>> =
>> class Person(models.Model):
>> fname=models.CharField(verbose_name="First Name",max_length=20,blank=
>> False)
>> lname = models.CharField(verbose_name="Last Name", max_length=20, blank=
>> False)
>> class Meta:
>> ordering =('id','fname','lname')
>> verbose_name="Person"
>> verbose_name_plural="Person"
>> def __str__(self):
>> return self.fname +" "+self.lname
>>
>> class Year (models.Model):
>> year = models.PositiveIntegerField(verbose_name="Year",unique=True )
>>
>> class Meta:
>> verbose_name = "Year"
>> verbose_name_plural = "Year"
>>
>>
>> def __str__(self):
>> return str(self.year)
>>
>> class Courses (models.Model):
>> course = models.CharField(verbose_name="Course", max_length=20, blank=
>> False,unique=True)
>> year = models.ForeignKey(Year,verbose_name="Year",on_delete
>> =models.SET_NULL,null=True )
>>
>> class Meta:
>> ordering = ('id', 'course','year')
>> verbose_name = "Coures"
>> verbose_name_plural = "Coures"
>>
>> def __str__(self):
>> return str(self.course)
>>
>> class PersonCourse(models.Model):
>> person = models.ForeignKey(Person, verbose_name="Person", on_delete
>> =models.SET_NULL,null=True)
>> course = models.ForeignKey(Courses,verbose_name="Course",on_delete
>> =models.SET_NULL,null=True)
>> year = models.ForeignKey(Year, verbose_name="Year", 
>> on_delete=models.SET_NULL,
>> null=True)
>>
>> class Meta:
>> ordering = ('id', 'person','course')
>> verbose_name = "PersonCourse"
>> verbose_name_plural = "PersonCourse"
>>
>> def __str__(self):
>> return self.person.lname +" "+self.person.lname
>> class Grade(models.Model):
>> person = models.ForeignKey(Person, verbose_name="Person", on_delete
>> =models.SET_NULL,null=True)
>> course = models.ForeignKey(Courses,verbose_name="Course",on_delete
>> =models.SET_NULL,null=True)
>> year = models.ForeignKey(Year, verbose_name="Year", 
>> on_delete=models.SET_NULL,
>> null=True)
>> mark=models.PositiveIntegerField(verbose_name="Marks" )
>> class Meta:
>> ordering = ('id', 'person','course')
>> verbose_name = "Grade"
>> verbose_name_plural = "Grade"
>>
>> def __str__(self):
>> return self.person.lname +" "+self.person.lname +" "+self.course.course
>>
>> = function ==
>> def Average(self,obj):
>> results=Grade.objects.filter(person=obj).aggregate(Avg("mark"))
>> return results['mark__avg']
>> Average.short_description="Average"
>>
>> 
>> if i run the function it returns the average of all the subjects in the
>> different year.
>> However i want it only to get the overage for a student in a separate year
>>
>> --
>> 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/9b9fb098-e560-4ace-8157-596a83d601b6n%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/CABJxPrGTH5DHHMw4oKVRizTr73%2BOgZ6n1%3DCkxbwDbYHuWLc8PQ%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/CAMVv_-HNk0qaDEAEQJe_PQqwSAEiYHM8qb_WH6be4h4%3Dz9TU-g%40mail.gmail.com.


Re: GETTING AVERAGE OF A STUDENT IN DIFFERENT YEARS

2022-08-01 Thread Opeyemi Ogunsanya
You have to add a year filter in the results query line.
results=Grade.objects.filter(person=obj).aggregate(Avg("mark"))

On Mon, Aug 1, 2022, 3:09 PM kateregga julius 
wrote:

> Hello Friends, i have the following models
>
> =
> class Person(models.Model):
> fname=models.CharField(verbose_name="First Name",max_length=20,blank=False
> )
> lname = models.CharField(verbose_name="Last Name", max_length=20, blank=
> False)
> class Meta:
> ordering =('id','fname','lname')
> verbose_name="Person"
> verbose_name_plural="Person"
> def __str__(self):
> return self.fname +" "+self.lname
>
> class Year (models.Model):
> year = models.PositiveIntegerField(verbose_name="Year",unique=True )
>
> class Meta:
> verbose_name = "Year"
> verbose_name_plural = "Year"
>
>
> def __str__(self):
> return str(self.year)
>
> class Courses (models.Model):
> course = models.CharField(verbose_name="Course", max_length=20, blank=
> False,unique=True)
> year = models.ForeignKey(Year,verbose_name="Year",on_delete
> =models.SET_NULL,null=True )
>
> class Meta:
> ordering = ('id', 'course','year')
> verbose_name = "Coures"
> verbose_name_plural = "Coures"
>
> def __str__(self):
> return str(self.course)
>
> class PersonCourse(models.Model):
> person = models.ForeignKey(Person, verbose_name="Person", on_delete
> =models.SET_NULL,null=True)
> course = models.ForeignKey(Courses,verbose_name="Course",on_delete
> =models.SET_NULL,null=True)
> year = models.ForeignKey(Year, verbose_name="Year", on_delete=models.SET_NULL,
> null=True)
>
> class Meta:
> ordering = ('id', 'person','course')
> verbose_name = "PersonCourse"
> verbose_name_plural = "PersonCourse"
>
> def __str__(self):
> return self.person.lname +" "+self.person.lname
> class Grade(models.Model):
> person = models.ForeignKey(Person, verbose_name="Person", on_delete
> =models.SET_NULL,null=True)
> course = models.ForeignKey(Courses,verbose_name="Course",on_delete
> =models.SET_NULL,null=True)
> year = models.ForeignKey(Year, verbose_name="Year", on_delete=models.SET_NULL,
> null=True)
> mark=models.PositiveIntegerField(verbose_name="Marks" )
> class Meta:
> ordering = ('id', 'person','course')
> verbose_name = "Grade"
> verbose_name_plural = "Grade"
>
> def __str__(self):
> return self.person.lname +" "+self.person.lname +" "+self.course.course
>
> = function ==
> def Average(self,obj):
> results=Grade.objects.filter(person=obj).aggregate(Avg("mark"))
> return results['mark__avg']
> Average.short_description="Average"
>
> 
> if i run the function it returns the average of all the subjects in the
> different year.
> However i want it only to get the overage for a student in a separate year
>
> --
> 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/9b9fb098-e560-4ace-8157-596a83d601b6n%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/CABJxPrGTH5DHHMw4oKVRizTr73%2BOgZ6n1%3DCkxbwDbYHuWLc8PQ%40mail.gmail.com.


Re: 如何在Django4.0.6中使用MongoDB数据库

2022-08-01 Thread Satyajit Barik
I am delighted to invite you on behalf of python & django to become a free
member today in WhatsApp group.


Here you can join in our WhatsApp group using below link



https://chat.whatsapp.com/Bq2jcxLJVG50v9Wbkvz6Vy


[Membership benefits] Here are some great perks you get for becoming a
member:

   - Ask your python & django related problems: get quick possible answer.
   - Friendly environment: you can learn python & django from core.
   - Daily Python Assignment exercise.


Thank you for your consideration, I look forward to hearing from you and
hope to see you at our WhatsApp python group.





On Wed, 20 Jul 2022 at 8:18 AM, Hella thor 
wrote:

> Hi guys
> 我查询了很多的资料,发现Django无法很好的连接MongoDB(该数据库在其他的服务器中),我需要解决如下问题:
>
> 1、在settings.py文件中设置连接MongoDB,需要密码
> 2、在models.py文件中建立模型
> 3、在views.py中进行数据的读写操作
>
> 我尝试了在python中进行连接,但是我不知道如何在Django中进行连接MongoDB,以下是我的环境配置信息:
>
> python==3.9.0
> django==4.0.6
> pymongo==4.1.1
> mongoengine==0.24.1
>
> DATABASE
> [image: 0220720104558.png]
>
> 如果您帮我,我将对您万分感谢。
>
> --
> 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/36c0e6d2-93aa-4a10-86ba-1de35a9b5e43n%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/CANd-%2BoAuebSZ9hukOtoBh1qTCPH-Zj-F1cg8YCpO6Nt0ihbstA%40mail.gmail.com.