Getting 4 four latest objects from django model

2023-02-27 Thread Byansi Samuel
I got a problem with my queryset. Am trying to get 4 latest objects from my
model but it returns  1 objects  the top latest.

Below is my code. Any support and guidance is appreciated.

#action/views.py

from  Action.models import ActionGame

latest_action= [ActionGame.objects.filter (os='windows',
category='action').latest ('published_date')][:4]

Buy the problem is that it returns 1 object yet l need 4 objects

What  can I do to solve 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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGQoQ3yN19LF0s2y-tiMYyyXuRnxfFA_UuCo6982_XpNpuCKRg%40mail.gmail.com.


Fwd: Getting 4 four latest objects from django model

2023-02-27 Thread Byansi Samuel
-- Forwarded message --
From:
Date: Feb 27, 2023 11:49 AM
Subject: Getting 4 four latest objects from django model
To: 
Cc:

I got a problem with my queryset. Am trying to get 4 latest objects from my
model but it returns  1 objects  the top latest.

Below is my code. Any support and guidance is appreciated.

#action/views.py

from  Action.models import ActionGame

latest_action= [ActionGame.objects.filter (os='windows',
category='action').latest ('published_date')][:4]

Buy the problem is that it returns 1 object yet l need 4 objects

What  can I do to solve 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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGQoQ3xyv3eEvgMQsTAO%3DXQtSsQo2XazBtKaHHxPFJ0-pvD%3DZg%40mail.gmail.com.


Re: Getting 4 four latest objects from django model

2023-02-27 Thread Muhammad Juwaini Abdul Rahman
latest_action= [ActionGame.objects.filter (os='windows',
category='action').latest ('published_date')[:4]]


On Mon, 27 Feb 2023 at 16:52, Byansi Samuel 
wrote:

> I got a problem with my queryset. Am trying to get 4 latest objects from
> my model but it returns  1 objects  the top latest.
>
> Below is my code. Any support and guidance is appreciated.
>
> #action/views.py
>
> from  Action.models import ActionGame
>
> latest_action= [ActionGame.objects.filter (os='windows',
> category='action').latest ('published_date')][:4]
>
> Buy the problem is that it returns 1 object yet l need 4 objects
>
> What  can I do to solve 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGQoQ3yN19LF0s2y-tiMYyyXuRnxfFA_UuCo6982_XpNpuCKRg%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/CAFKhtoS_Tsrz00iGCAb3OUNzGeR0b5AAQgyj6ZbHxgg8-taqeQ%40mail.gmail.com.


Re: Getting 4 four latest objects from django model

2023-02-27 Thread Byansi Samuel
Thanks but it returned an error that,

'ActionGame' is not subcriptabe

Do you have a way of solving this typerror?

On Feb 27, 2023 11:55 AM, "Muhammad Juwaini Abdul Rahman" 
wrote:

> latest_action= [ActionGame.objects.filter (os='windows',
> category='action').latest ('published_date')[:4]]
>
>
> On Mon, 27 Feb 2023 at 16:52, Byansi Samuel 
> wrote:
>
>> I got a problem with my queryset. Am trying to get 4 latest objects from
>> my model but it returns  1 objects  the top latest.
>>
>> Below is my code. Any support and guidance is appreciated.
>>
>> #action/views.py
>>
>> from  Action.models import ActionGame
>>
>> latest_action= [ActionGame.objects.filter (os='windows',
>> category='action').latest ('published_date')][:4]
>>
>> Buy the problem is that it returns 1 object yet l need 4 objects
>>
>> What  can I do to solve 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 django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/CAGQoQ3yN19LF0s2y-tiMYyyXuRnxfFA_UuCo6982_
>> XpNpuCKRg%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/CAFKhtoS_Tsrz00iGCAb3OUNzGeR0b5AAQgyj6Z
> bHxgg8-taqeQ%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/CAGQoQ3yWPLWNq9xMHe_NrF-uaUY6JnvEiT_R_VwhvH_c3x1gmw%40mail.gmail.com.


Error loading static file from a NAS (CIFS mounted) Not 404...

2023-02-27 Thread Hua Liang
Hello,

I have a django site and I have two storages serving static files.
One is a hard drive attached to the server and the other is a NAS share.

Both are mounted and I can view the files in Ubuntu without any problems.

Both are linked to Django static folder.

The problem is that when I tried to access the file from Django web, the 
NAS one always fails with corrupted file.
e.g. I have an image file image.jpg in both local drive and NAS share

lets say "static/media1" is linked to the local drive, and "static/media2" 
is linked to the nas share
if I visit
http://django-site-ip/static/media1/image.jpg, it is fine.
if I visit
http://django-site-ip/static/media2/image.jpg, it is corrupted. (but I can 
view it in ubuntu)

I downloaded the image from the site and I found that the size is different 
compared to the original file.

Anyone knows what the issue is?

Thanks

-- 
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/dd60520c-619a-4492-998f-b90dba1dd170n%40googlegroups.com.


django

2023-02-27 Thread Ikrombek
Hello
Can I create strongest dashboard with django 

-- 
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/f305c42f-915a-46d5-b535-559b18bb5040n%40googlegroups.com.


Re: django

2023-02-27 Thread Benjamin Telford
Hello. lkrombek

I have just read your email, and the answer of your email is "Yes."
I can help you to create the wonderful dashboard using frontend
framework such as React, Vue and Angular etc. Also, you can use the
dashboard that be provided by Django
My experience will be helpful for your issue.

Benjamin Telford

On Mon, Feb 27, 2023 at 9:29 AM Ikrombek  wrote:

> Hello
> Can I create strongest dashboard with django
>
> --
> 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/f305c42f-915a-46d5-b535-559b18bb5040n%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/CAKnkAk%3DJoXQxhmOBxyRSG8i80PMxNKDWUz25B4%3D7-SWL_iwthw%40mail.gmail.com.


Re: django

2023-02-27 Thread OSP PRO
Yes, Django is much trustworthy admin dashboard, than other frameworks.

On Mon, Feb 27, 2023 at 5:29 PM Ikrombek  wrote:

> Hello
> Can I create strongest dashboard with django
>
> --
> 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/f305c42f-915a-46d5-b535-559b18bb5040n%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/CACng%3Deibg0sfVojeAVoZmFxHZyFGZtyLwgN%3D8%3DY3q6r0Bpc1KA%40mail.gmail.com.


Re: django

2023-02-27 Thread Abhishek ozha
I just created a normal school name adding API and how do I add role based
authentication In that

On Mon, Feb 27, 2023, 8:24 PM OSP PRO  wrote:

> Yes, Django is much trustworthy admin dashboard, than other frameworks.
>
> On Mon, Feb 27, 2023 at 5:29 PM Ikrombek  wrote:
>
>> Hello
>> Can I create strongest dashboard with django
>>
>> --
>> 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/f305c42f-915a-46d5-b535-559b18bb5040n%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/CACng%3Deibg0sfVojeAVoZmFxHZyFGZtyLwgN%3D8%3DY3q6r0Bpc1KA%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/CAKg7BM%3DFFq8rC%2B_KmJ2TFpAfk-pww2xAvYLybs9w7z39CnRVmA%40mail.gmail.com.


List validator

2023-02-27 Thread Larry Martell
I have this defined in my serializer:

case_status = serializers.ListField(
child=serializers.CharField(
allow_blank=True,
max_length=512,
allow_null=True,
required=False,
default="''",
),
source='casestatus',
required=False,
allow_empty=True,
)

When this data is received:

(Pdb) request.data


The casestatus field is not picked up:

(Pdb) serializer.validated_data
OrderedDict([('patientid', 0), ('pk', 0), ('patientname', "''"),
('dobstart', "''"), ('dobend', "''"), ('scanstart', "''"), ('scanend',
"''"), ('workitemstr', "''"), ('institutionid', 0), ('page_size', 10),
('sortByDateCreated', 'true')])

Can anyone see what I am doing wrong here?

-- 
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/CACwCsY6-wEO-vVDn_mhb8t0-w2C5vXyw-08EeuUeiAPmMK_oqw%40mail.gmail.com.


Getting InspectDB to work with postgres

2023-02-27 Thread Kyle Wan
Hi,

I'm new to Django, and I'm struggling to get inspectdb to populate postgres 
models as json, hstore, or array objects. I have put 
`django.contrib.postgres` under the INSTALLED_APPS and I have psycopg2 
installed. I have set my engine to be postgresql and am able to use the 
makemigration and migrate CLI.

Do I need to do anything extra to get this working? I know inspectdb may 
not work because it is guessing, but it seems like this is a solved issue 
in terms of json, hstore, and array for postgres as many people have asked 
about this issue years past. I am using version 4.1.7 of django.

I'm trying to make an automated script for creating the migration with 
inspectdb -> makemigration -> migrate, but there is no easy way for 
detecting what type the inspectdb guessed as TextField.

Thanks!

-- 
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/7c1651d6-3071-4de1-9d3a-63e5c6c3f2fan%40googlegroups.com.


Re: Error loading static file from a NAS (CIFS mounted) Not 404...

2023-02-27 Thread Hua Liang

Okay I think I know the problem.

Apache2 has a bug with CIFS, set EnableMMAP Off in config will solve this.
On Monday, February 27, 2023 at 6:29:12 AM UTC-8 Hua Liang wrote:

> Hello,
>
> I have a django site and I have two storages serving static files.
> One is a hard drive attached to the server and the other is a NAS share.
>
> Both are mounted and I can view the files in Ubuntu without any problems.
>
> Both are linked to Django static folder.
>
> The problem is that when I tried to access the file from Django web, the 
> NAS one always fails with corrupted file.
> e.g. I have an image file image.jpg in both local drive and NAS share
>
> lets say "static/media1" is linked to the local drive, and "static/media2" 
> is linked to the nas share
> if I visit
> http://django-site-ip/static/media1/image.jpg, it is fine.
> if I visit
> http://django-site-ip/static/media2/image.jpg, it is corrupted. (but I 
> can view it in ubuntu)
>
> I downloaded the image from the site and I found that the size is 
> different compared to the original file.
>
> Anyone knows what the issue is?
>
> Thanks
>

-- 
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/621024f7-3a1a-4640-a9cb-5f1baf4d99ebn%40googlegroups.com.


Need way of authentication with google without using an allauth packages

2023-02-27 Thread MaheshKumar
I need how to create an google authentication without using the django 
-allauth packages.


Please give me an idea to create an flow of authentication with google in 
django

-- 
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/cafb233e-2689-4613-adf0-7751bcbdce94n%40googlegroups.com.