Re: How to get names of columns from QuerySet without executing it

2020-07-04 Thread Eugene Kulak
The closes I can get with this is the following:

comp = queryset.query.get_compiler(DEFAULT_DB_ALIAS)
fields = [alias or sql.split('.')[1] for _, (sql, _), alias in 
comp.get_select()[0]]


On Saturday, July 4, 2020 at 4:11:41 PM UTC-4, Eugene Kulak wrote:
>
> How to get names of columns from QuerySet without executing it?
> If it is not possible what would be the most easier way to execute a 
> lighter version of the query. 
> The query itself is unknown, it could be anything.
>

-- 
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/46698def-fab7-492a-bbd5-a8190b947aa2o%40googlegroups.com.


Django

2020-07-04 Thread Exactly musty
Are you serious from scratch?don't you read the documentation 

-- 
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/3b378fd6-6218-4804-962f-9816ad948570o%40googlegroups.com.


Re: How to get names of columns from QuerySet without executing it

2020-07-04 Thread Eugene Kulak
I think reading the question first and answer only when you have anything 
to say is even better?

On Saturday, July 4, 2020 at 5:08:04 PM UTC-4, Vishesh Mangla wrote:
>
> I think learning some sql commands would be good. Lots of youtube tuts 
> available online. 
> https://docs.djangoproject.com/en/3.0/topics/db/sql/#executing-custom-sql-directly
>
> On Sun, Jul 5, 2020 at 1:59 AM Akinfolarin Stephen  > wrote:
>
>> you can filter out the column you want by using 
>> [name of model].objects.get(filter=[name of the column you want])
>>
>> On Sun, Jul 5, 2020 at 10:12 AM Eugene Kulak > > wrote:
>>
>>> How to get names of columns from QuerySet without executing it?
>>> If it is not possible what would be the most easier way to execute a 
>>> lighter version of the query. 
>>> The query itself is unknown, it could be anything.
>>>
>>> -- 
>>> 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...@googlegroups.com .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/60c63ddd-80fa-44c5-9a8e-10091e307099o%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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAFujGLyz6U%3D4t3RSiiAzOo5jkXiCc7bcvzYYyD4do3R-fgbdoQ%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/ca3d2a39-1a84-4e85-bc47-c5afa8aebbf8o%40googlegroups.com.


Re: How to get names of columns from QuerySet without executing it

2020-07-04 Thread Eugene Kulak
Thank you, Stephen, but this is not what I asked. I can't change QuerySet 
and I don't know how it looks like.

On Saturday, July 4, 2020 at 4:30:40 PM UTC-4, Akinfolarin Stephen wrote:
>
> you can filter out the column you want by using 
> [name of model].objects.get(filter=[name of the column you want])
>
> On Sun, Jul 5, 2020 at 10:12 AM Eugene Kulak  > wrote:
>
>> How to get names of columns from QuerySet without executing it?
>> If it is not possible what would be the most easier way to execute a 
>> lighter version of the query. 
>> The query itself is unknown, it could be anything.
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/60c63ddd-80fa-44c5-9a8e-10091e307099o%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/4803a8d6-71bd-4fcf-80fb-35aa504db74bo%40googlegroups.com.


Re: How to get names of columns from QuerySet without executing it

2020-07-04 Thread Vishesh Mangla
I think learning some sql commands would be good. Lots of youtube tuts
available online.
https://docs.djangoproject.com/en/3.0/topics/db/sql/#executing-custom-sql-directly

On Sun, Jul 5, 2020 at 1:59 AM Akinfolarin Stephen <
akinfolarinsteph...@gmail.com> wrote:

> you can filter out the column you want by using
> [name of model].objects.get(filter=[name of the column you want])
>
> On Sun, Jul 5, 2020 at 10:12 AM Eugene Kulak 
> wrote:
>
>> How to get names of columns from QuerySet without executing it?
>> If it is not possible what would be the most easier way to execute a
>> lighter version of the query.
>> The query itself is unknown, it could be anything.
>>
>> --
>> 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/60c63ddd-80fa-44c5-9a8e-10091e307099o%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/CAFujGLyz6U%3D4t3RSiiAzOo5jkXiCc7bcvzYYyD4do3R-fgbdoQ%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/CACaE8x7k9WTwn4yCaCwdfBWbCBD68exhzetVt1Mp_%3DF1buhgrg%40mail.gmail.com.


Django

2020-07-04 Thread Tanni Seriki
Please can someone leature me on how to get post details using slug... From 
scratch, am confused. Help a brother out please.
Please!!!

-- 
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/b758f436-a030-4f59-bff5-5009b80209a5o%40googlegroups.com.


Re: How to get names of columns from QuerySet without executing it

2020-07-04 Thread Akinfolarin Stephen
you can filter out the column you want by using
[name of model].objects.get(filter=[name of the column you want])

On Sun, Jul 5, 2020 at 10:12 AM Eugene Kulak 
wrote:

> How to get names of columns from QuerySet without executing it?
> If it is not possible what would be the most easier way to execute a
> lighter version of the query.
> The query itself is unknown, it could be anything.
>
> --
> 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/60c63ddd-80fa-44c5-9a8e-10091e307099o%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/CAFujGLyz6U%3D4t3RSiiAzOo5jkXiCc7bcvzYYyD4do3R-fgbdoQ%40mail.gmail.com.


How to get names of columns from QuerySet without executing it

2020-07-04 Thread Eugene Kulak
How to get names of columns from QuerySet without executing it?
If it is not possible what would be the most easier way to execute a 
lighter version of the query. 
The query itself is unknown, it could be anything.

-- 
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/60c63ddd-80fa-44c5-9a8e-10091e307099o%40googlegroups.com.


Re: Need Covid 19 Database for Experiments

2020-07-04 Thread Aldian Fazrihady
There are covid-19 datasets in Google Cloud Platform ready to be queried.
You can go to https://console.cloud.google.com/bigquery and immediately
execute a covid-19 related query, for example:
```
SELECT * FROM
`bigquery-public-data.covid19_ecdc.covid_19_geographic_distribution_worldwide`
WHERE countries_and_territories LIKE '%America%' AND date > '2020-03-01'
ORDER BY date DESC
```

On Fri, Jul 3, 2020 at 12:38 AM Balaji Shetty 
wrote:

> Hi
>
> Can anyone provide me Covid 19 Database.
> I need Covid 19 Database for Experiments
>
> Thank you
>
>
> --
> Mr Shetty Balaji
> Asst. Prof.
> IT Department
> SGGS I
> Nanded. My. India
>
> --
> 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/CAECSbOuuNCY58sB1g2f_ftHtpAs3FamSq%2BBJJZ%2BA5mv_3%3Dw3NQ%40mail.gmail.com
> 
> .
>


-- 
Regards,

Aldian Fazrihady
http://aldianfazrihady.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/CAN7EoAbY1Kr9EWw21SdnsDXWV8Cwr_FBCbAT5WtECv_gmOUjug%40mail.gmail.com.


Re: Custom-DRF-Response

2020-07-04 Thread Karthik Marudhanayagam
Hi, please refer
https://stackoverflow.com/questions/47173483/django-rest-framework-custom-format-for-all-out-responses

hope this helps.

Best
Karthik

On Sat, Jul 4, 2020 at 5:30 PM Ronaldo Mata  wrote:

> Thx for your answer. 
>
> but this brings me to the second point. If I do that I must to rewrite all
> method in my API Class Based Views to response with this format. I think
> that is not the best way to deal with this problem. What do you think?
>
> El sáb., 4 jul. 2020 a las 7:53, Arpana Mehta ()
> escribió:
>
>> You can use a function which
>>
>> returns Response({'status': 'SUCCESS'})
>>
>> On Sat, 4 Jul 2020, 03:24 Ronaldo Mata,  wrote:
>>
>>> Hi Guys
>>>
>>> Somebody can help me?
>>>
>>> I want to create a custom response with the follow format:
>>>
>>> {
>>>   "status": true,
>>>   "message": "Any message",
>>>   "data": []}
>>>
>>>
>>> but I don't want create a custom_response function because I must to
>>> modified all Api class based views response. What is the best way to deal
>>> with this?
>>>
>>> --
>>> 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/CAP%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%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/CAGyqUuVGdobfwZgwmUsWj94YWimTNwhE0aYmi9seZAYU7TkaCw%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/CAP%3DoziTUi-B3OPZ9U6US8p2Jm%3DXGmrGs%2BHvXBXQvCYDAYjtMTw%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/CAA0PHa8t6dFWmtYRcd5fsrmWCZ6e14P9PjcEyvVDEz%2BJHejFSA%40mail.gmail.com.


Re: Custom-DRF-Response

2020-07-04 Thread Ronaldo Mata
I Think that this should be a common approach, since many famous frontend
framework is easier to create logic to deal with that format response.

El sáb., 4 jul. 2020 a las 10:00, Ronaldo Mata ()
escribió:

> I think that this not depend of my serializer. I only want that the
> response data will be inside data variable in the JSON response and i need
> to add status variable and message to the JSON response. I can to rewrite
> all Class Based Views of DRF to response with my desired format. but this
> sound not very good.
>
> I can do this:
>
> def post(self, request, *args, **kwargs):
> ...blah...blah
> ...return Response({ 'status': true, 'message': 'login success',
> 'data': {'token':'345rjgjfegjgdsaj,fdgjsafgj'}})
>
> right?
>
> but this required rewrite all DRF methods on Class Based Views to change
> the response format.
>
> I'm trying to use Renderers. I think that is the best for this. But I'm
> not sure how to pass message from views to renderers. it returns me to the
> same problem.
>
> But this required pass from every view message attribute to data (since
> all messages depend on the view) example:
>
> { status: True, message:"user regitered", data: {user: {user detail,
> token...}}} (Register View) --> has custom message
> { status: True, message:"logout successfully", data: {} (Logout View) -->
> has custom message
>
>
> from rest_framework import status
> from rest_framework.renderers import JSONRenderer
>
>
> class GlobalJSONRenderer(JSONRenderer):
>
> def render(self, data, accepted_media_type=None, renderer_context=None
> ):
> """
> this function change the response format to return the follow
> format:
>
> {
> 'status': True o False, -> Depend of status code
> 'message': '', -> A message (not yet)
> 'data': {} -> All Data
> }
> """
> data = {
> 'status': False,
> 'message': '',
> 'data': data
> }
> response = renderer_context['response']
> status_code = response.status_code
>
> if status.is_success(status_code):
> data['status'] = True
>
> return super(GlobalJSONRenderer, self).render(
> data,
> accepted_media_type,
> renderer_context
> )
>
>
> El sáb., 4 jul. 2020 a las 9:34, Julio Cojom ()
> escribió:
>
>> How is your model and your serializer?
>>
>> El sáb., 4 jul. 2020 a las 6:00, Ronaldo Mata ()
>> escribió:
>>
>>> Thx for your answer. 
>>>
>>> but this brings me to the second point. If I do that I must to rewrite
>>> all method in my API Class Based Views to response with this format. I
>>> think that is not the best way to deal with this problem. What do you think?
>>>
>>> El sáb., 4 jul. 2020 a las 7:53, Arpana Mehta ()
>>> escribió:
>>>
 You can use a function which

 returns Response({'status': 'SUCCESS'})

 On Sat, 4 Jul 2020, 03:24 Ronaldo Mata, 
 wrote:

> Hi Guys
>
> Somebody can help me?
>
> I want to create a custom response with the follow format:
>
> {
>   "status": true,
>   "message": "Any message",
>   "data": []}
>
>
> but I don't want create a custom_response function because I must to
> modified all Api class based views response. What is the best way to deal
> with this?
>
> --
> 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/CAP%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%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/CAGyqUuVGdobfwZgwmUsWj94YWimTNwhE0aYmi9seZAYU7TkaCw%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: Custom-DRF-Response

2020-07-04 Thread Ronaldo Mata
I think that this not depend of my serializer. I only want that the
response data will be inside data variable in the JSON response and i need
to add status variable and message to the JSON response. I can to rewrite
all Class Based Views of DRF to response with my desired format. but this
sound not very good.

I can do this:

def post(self, request, *args, **kwargs):
...blah...blah
...return Response({ 'status': true, 'message': 'login success',
'data': {'token':'345rjgjfegjgdsaj,fdgjsafgj'}})

right?

but this required rewrite all DRF methods on Class Based Views to change
the response format.

I'm trying to use Renderers. I think that is the best for this. But I'm not
sure how to pass message from views to renderers. it returns me to the same
problem.

But this required pass from every view message attribute to data (since all
messages depend on the view) example:

{ status: True, message:"user regitered", data: {user: {user detail,
token...}}} (Register View) --> has custom message
{ status: True, message:"logout successfully", data: {} (Logout View) -->
has custom message


from rest_framework import status
from rest_framework.renderers import JSONRenderer


class GlobalJSONRenderer(JSONRenderer):

def render(self, data, accepted_media_type=None, renderer_context=None):
"""
this function change the response format to return the follow
format:

{
'status': True o False, -> Depend of status code
'message': '', -> A message (not yet)
'data': {} -> All Data
}
"""
data = {
'status': False,
'message': '',
'data': data
}
response = renderer_context['response']
status_code = response.status_code

if status.is_success(status_code):
data['status'] = True

return super(GlobalJSONRenderer, self).render(
data,
accepted_media_type,
renderer_context
)


El sáb., 4 jul. 2020 a las 9:34, Julio Cojom ()
escribió:

> How is your model and your serializer?
>
> El sáb., 4 jul. 2020 a las 6:00, Ronaldo Mata ()
> escribió:
>
>> Thx for your answer. 
>>
>> but this brings me to the second point. If I do that I must to rewrite
>> all method in my API Class Based Views to response with this format. I
>> think that is not the best way to deal with this problem. What do you think?
>>
>> El sáb., 4 jul. 2020 a las 7:53, Arpana Mehta ()
>> escribió:
>>
>>> You can use a function which
>>>
>>> returns Response({'status': 'SUCCESS'})
>>>
>>> On Sat, 4 Jul 2020, 03:24 Ronaldo Mata,  wrote:
>>>
 Hi Guys

 Somebody can help me?

 I want to create a custom response with the follow format:

 {
   "status": true,
   "message": "Any message",
   "data": []}


 but I don't want create a custom_response function because I must to
 modified all Api class based views response. What is the best way to deal
 with this?

 --
 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/CAP%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%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/CAGyqUuVGdobfwZgwmUsWj94YWimTNwhE0aYmi9seZAYU7TkaCw%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/CAP%3DoziTUi-B3OPZ9U6US8p2Jm%3DXGmrGs%2BHvXBXQvCYDAYjtMTw%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, 

One field form - do i need Form class

2020-07-04 Thread Jan Gregorczyk
I want to have search form with just one field. Should I use Form class or
is it overkill?

-- 
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/CAFyHfE2D4kUYygEMPujTv-WFyjedtf_drB7304_aayUeMQMTEA%40mail.gmail.com.


Re: Custom-DRF-Response

2020-07-04 Thread Julio Cojom
How is your model and your serializer?

El sáb., 4 jul. 2020 a las 6:00, Ronaldo Mata ()
escribió:

> Thx for your answer. 
>
> but this brings me to the second point. If I do that I must to rewrite all
> method in my API Class Based Views to response with this format. I think
> that is not the best way to deal with this problem. What do you think?
>
> El sáb., 4 jul. 2020 a las 7:53, Arpana Mehta ()
> escribió:
>
>> You can use a function which
>>
>> returns Response({'status': 'SUCCESS'})
>>
>> On Sat, 4 Jul 2020, 03:24 Ronaldo Mata,  wrote:
>>
>>> Hi Guys
>>>
>>> Somebody can help me?
>>>
>>> I want to create a custom response with the follow format:
>>>
>>> {
>>>   "status": true,
>>>   "message": "Any message",
>>>   "data": []}
>>>
>>>
>>> but I don't want create a custom_response function because I must to
>>> modified all Api class based views response. What is the best way to deal
>>> with this?
>>>
>>> --
>>> 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/CAP%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%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/CAGyqUuVGdobfwZgwmUsWj94YWimTNwhE0aYmi9seZAYU7TkaCw%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/CAP%3DoziTUi-B3OPZ9U6US8p2Jm%3DXGmrGs%2BHvXBXQvCYDAYjtMTw%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/CAHRQUHm1hgchtYWMEHj%2B7PHomErn7TGXD3Vc9SpOwp%2BvGsVx5w%40mail.gmail.com.


Re: Custom-DRF-Response

2020-07-04 Thread Ronaldo Mata
Thx for your answer. 

but this brings me to the second point. If I do that I must to rewrite all
method in my API Class Based Views to response with this format. I think
that is not the best way to deal with this problem. What do you think?

El sáb., 4 jul. 2020 a las 7:53, Arpana Mehta ()
escribió:

> You can use a function which
>
> returns Response({'status': 'SUCCESS'})
>
> On Sat, 4 Jul 2020, 03:24 Ronaldo Mata,  wrote:
>
>> Hi Guys
>>
>> Somebody can help me?
>>
>> I want to create a custom response with the follow format:
>>
>> {
>>   "status": true,
>>   "message": "Any message",
>>   "data": []}
>>
>>
>> but I don't want create a custom_response function because I must to
>> modified all Api class based views response. What is the best way to deal
>> with this?
>>
>> --
>> 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/CAP%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%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/CAGyqUuVGdobfwZgwmUsWj94YWimTNwhE0aYmi9seZAYU7TkaCw%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/CAP%3DoziTUi-B3OPZ9U6US8p2Jm%3DXGmrGs%2BHvXBXQvCYDAYjtMTw%40mail.gmail.com.


Re: Custom-DRF-Response

2020-07-04 Thread Arpana Mehta
You can use a function which

returns Response({'status': 'SUCCESS'})

On Sat, 4 Jul 2020, 03:24 Ronaldo Mata,  wrote:

> Hi Guys
>
> Somebody can help me?
>
> I want to create a custom response with the follow format:
>
> {
>   "status": true,
>   "message": "Any message",
>   "data": []}
>
>
> but I don't want create a custom_response function because I must to
> modified all Api class based views response. What is the best way to deal
> with this?
>
> --
> 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/CAP%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%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/CAGyqUuVGdobfwZgwmUsWj94YWimTNwhE0aYmi9seZAYU7TkaCw%40mail.gmail.com.


Unable to export images from django model to excel sheet

2020-07-04 Thread Ashutosh Mishra
I have posted on stack overflow.I want export images from django model to excel 
sheet.while doing I am just getting the root media address on excel sheet not 
image.
Please help ,it's urgent.

https://stackoverflow.com/questions/62695531/unable-to-export-images-from-django-model-to-excel-sheet-using-xlwt

-- 
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/b421efaa-4ba6-4bf6-bd09-e7ee8ad7cfdao%40googlegroups.com.


Re: Django how get Post details using slug

2020-07-04 Thread arman hossain
please try

On Sat, Jul 4, 2020 at 9:38 AM Tanni Seriki  wrote:

> Thanks sir, I will make changes.
> I really appreciate your time and effort in helping me out with this
> Thanks
>
> On Fri, Jul 3, 2020, 11:14 PM coolguy 
> wrote:
>
>> One more thing. if your view code is indented exactly the way it is in
>> the provided then you need to fix the indentation of
>>
>> def post_details_view(request, post):
>>
>> This should be under class SearchResultsViews()
>>
>> like this...
>>
>> class SearchResultsViews(ListView):
>> model = Post
>> template_name = 'Search.html'
>>
>> def get_queryset(self):
>> query = self.request.GET.get('q')
>> object_list = Post.objects.filter(Q(title__icontains=query))
>> return object_list
>>
>>
>> def post_details_view(request, post):
>> f = get_object_or_404(Post, slug=post)
>> return render(request, 'post_details.html', {'f': f})
>>
>>
>> On Friday, July 3, 2020 at 5:10:14 PM UTC-4, Tanni Seriki wrote:
>>>
>>> Please let me know if you have seen the file.
>>> Am sorry am sending it to you as file, my phone is malfunctioning
>>>
>>> On Fri, Jul 3, 2020, 9:49 PM Tanni Seriki  wrote:
>>>
 Sir here it's all the project, currently my phone camera has fault
 please help me out.

 On Fri, Jul 3, 2020, 9:23 PM coolguy  wrote:

> I am away at this time but can you send the project urls.py screen
> shot as well.
>
> On Friday, July 3, 2020 at 4:09:01 PM UTC-4, Tanni Seriki wrote:
>>
>> Here is my WhatsApp number
>> +2348095594236
>> Please I really need to solve this out
>>
>> On Fri, Jul 3, 2020, 9:07 PM Tanni Seriki 
>> wrote:
>>
>>> Coolguy
>>> Please can we chat on WhatsApp...
>>> The post details is really giving me headache, please help out
>>>
>>> On Fri, Jul 3, 2020, 9:04 PM coolguy 
>>> wrote:
>>>
 Seems pretty simple unless you have specific question about
 something.

 You have a model which has some fields including Slug field which
 should be unique i.e. unique=True but your screen shot is not clear..

 In views you are overriding the get_queryset() method of base class
 and assigning it to query variable for the 'q' from http GET request. 
 Then
 filtering Post data with the values in query object you have just 
 created.
 Finally returned the revised object_list including this new query 
 context.

 In post_detail_views you are retrieving data from Post based on the
 post slug and assigning it to variable 'f'. Finally you used the 
 render()
 shortcut to render the retrieved post using a template.

 In your urlpatterns you have defined the path for your post_detail
 which send the post as a slug to your view and in turn view returns the
 HTTP response.

 On Friday, July 3, 2020 at 11:10:22 AM UTC-4, Tanni Seriki wrote:
>
> Please can someone put me through on this, post details view
> either one the function based view or class based view. 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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/d2457503-b332-4f26-8f8a-cda32934419fo%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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bd9d5723-7eed-4334-9d6c-de5a076883ebo%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/6bc99e96-0830-4e23-9482-cd4268c14329o%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To 

Re: Need Covid 19 Database for Experiments

2020-07-04 Thread Luciano Martins
Hello, you have an excellent job done by devs and Brazilian journalists...

https://brasil.io/covid19/

Em quinta-feira, 2 de julho de 2020 14:38:51 UTC-3, Balaji escreveu:
>
> Hi
>
> Can anyone provide me Covid 19 Database.
> I need Covid 19 Database for Experiments 
>
> Thank you 
>
>
> -- 
> Mr Shetty Balaji
> Asst. Prof.
> IT Department
> SGGS I
> Nanded. My. India
>
>

-- 
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/33f46c79-c80c-456e-9cc1-f1d43167a593o%40googlegroups.com.


Re: Unable to modify Session with signed_cookies backend

2020-07-04 Thread Krishna Chaitanya
Hi,

Thanks. I know how to isntallle using pip but pip isn't installed in our
devices, and moreover there is no difference in the code with layers
version.

On Sat, 4 Jul, 2020, 8:04 am Ogunsanya Opeyemi, 
wrote:

>
> Hi,
> Serach for pip install url on ubuntu then you for you to get pip installed.
> On Friday, July 3, 2020, Krishna Chaitanya 
> wrote:
>
>> Hi,
>>
>> When I try to modify a session when using signed_cookies backend it
>> creates a new session which voids
>> the purpose as I am using session_key as a shared data structures across
>> views/functions.
>>
>> Is this expected or a bug? I am using 1.11 (default on ubuntu 18.04,
>> can't update as pip isn't allowed), but even
>> looking at the latest source
>> https://github.com/django/django/blob/master/django/contrib/sessions/backends/signed_cookies.py#L41
>> the behavior isn't changed.
>>
>> The same logic works fine with db/file backends but can't use that due to
>> low storage issues.
>>
>> Any help is appreciated?
>>
>> 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/e399f194-2fd7-4fae-a002-7599badce3b3o%40googlegroups.com
>> 
>> .
>>
>
>
> --
> OGUNSANYA OPEYEMI
>
> --
> 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/CABJxPrGaq7b53Ev4HkuZ93XYrwJ5njOS1CCsZ9Gxn%3D-hDKLU0Q%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/CABPxzYJsYeOQofvCZGkMbY3WRsjgKyNoWnmU2zGOrNJkmXK8Lw%40mail.gmail.com.