Re: use of annotate in django query

2021-06-02 Thread Eugene TUYIZERE
Dear Latit,

Thank you very much. Now how can I display 30 last records? Regardless of
how many records I may have ! Just the last 30 records!

Thank you

On Thu, 3 Jun 2021 at 06:51, Lalit Suthar  wrote:

> > in brief, I want to transform this query in django query
> this will be equivalent to this query in django
>
> Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name"))
>
>
> On Thu, 3 Jun 2021 at 02:02, Eugene TUYIZERE 
> wrote:
>
>> in brief, I want to transform this query in django query
>>
>> [image: image.png]
>>
>> On Wed, 2 Jun 2021 at 21:56, Eugene TUYIZERE 
>> wrote:
>>
>>> Dear Sebatian,
>>>
>>> This is what I get:
>>>
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-03 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-04 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-05 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-06 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-07 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-08 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-09 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-10 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-11 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-12 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-13 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-14 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-15 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-16 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>>> 2021-05-17 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>> SELECT `crms_customer_requests`.`arrival_date`,
>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=

Re: use of annotate in django query

2021-06-02 Thread Lalit Suthar
> in brief, I want to transform this query in django query
this will be equivalent to this query in django
Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name"))


On Thu, 3 Jun 2021 at 02:02, Eugene TUYIZERE 
wrote:

> in brief, I want to transform this query in django query
>
> [image: image.png]
>
> On Wed, 2 Jun 2021 at 21:56, Eugene TUYIZERE 
> wrote:
>
>> Dear Sebatian,
>>
>> This is what I get:
>>
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-03 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-04 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-05 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-06 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-07 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-08 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-09 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-10 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-11 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-12 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-13 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-14 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-15 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-16 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-17 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-18 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-19 GROUP BY 

Re: SVG widget for the Admin

2021-06-02 Thread Mike Dewhirst
DerekI pretty much tried what you suggested. I dont have access to my machine 
atm so that's all I can really say. I looked at the link and understand the 
list customisation because I already use it elsewhere. It does look like I'll 
have to switch in my own template so I can include a safe filter.Thanks 
againMike--(Unsigned mail from my phone)
 Original message From: Derek  Date: 
2/6/21  23:39  (GMT+10:00) To: Django users  
Subject: Re: SVG widget for the Admin When you say "I tried your suggestion and 
had no success." what exactly did you try  - i.e. what code did you use and 
what errors did you get?WRT "Not sure where this should live for the Admin to 
call it and display the image." - it lives exactly as I showed it in my 
example; its a user-defined property for the model in which the SVG text is 
stored.  You can use it in the admin as you would the normal model fields. 
There is a good example of defining and using your own derived 'field'  
here:https://realpython.com/customize-django-admin-python/#modifying-a-change-list-using-list_display(Please
 note that to show HTML strings, you need to use the format_html() method. 
Ignore mt previous reference to "allow_tags" as this is deprecated.)DerekOn 
Wednesday, 2 June 2021 at 10:05:11 UTC+2 Mike Dewhirst wrote:On 1/06/2021 11:44 
pm, Derek wrote:
> You haven't defined where in the admin interface you want this image 
> to be displayed?  A table?
>
> I have not tried this, but could you not create an additional field on 
> your model that returns the HTML-encoding needed to display the SVG?

Derek, thanks for responding. I tried your suggestion and had no success.

Where in the admin? Just among a normal roster of fields. The svg is a 
molecular structure and the image needs to appear for example just after 
the molecular formula. I collect the actual svg code via a public API on 
saving the record.

>
> E.g.
>
> class MyModel():
>     svg_text = CharField()

in my case it is ...

class chemical(models.Model):
     ...
     ddstructure = models.TextField(
     null=True,
     blank=True,
     verbose_name="2D structure",
     )

>
>     def _the_svg(self):
>         return """%s""" % 
> self.svg_text
>         _the_svg.allow_tags = True

Not sure where this should live for the Admin to call it and display the 
image.


> I am not sure about editing visually, however - I would expect that 
> would require a specialised widget.

It is read-only in all cases.

I was thinking a widget might be needed just for display. The svg code 
arrives complete with tags so really all it needs is a mechanism to 
persuade the admin it is safe to render as is.

I haven't seen such a (probably insecure) "feature" previously. I've 
looked through the docs but haven't found it yet.

Thanks again

Mike


>
> HTH
> Derek
>
>
> On Tuesday, 1 June 2021 at 03:28:59 UTC+2 Mike Dewhirst wrote:
>
> I collect the svg source for an image from a public API and store
> it in
> a models.TextField. I have no difficulty displaying it in a normal
> view
> and my own template. Nothing special, it just emerges. I don't
> even need
> a 'safe' filter.
>
> However, I really want to display such images in the Admin. At this
> stage all it displays is the svg source.
>
> What is the correct way to make the image appear in the Admin?
>
> Do I need a special field inheriting from TextField? Do I need a
> special
> widget? Is there a way to mark admin field values as safe?
>
> Thanks for any hints
>
> Mike
>
> -- 
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/520bf296-ec68-48ad-8fe2-f106823efac2n%40googlegroups.com
>  
> .


-- 
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.






-- 
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 

Re: use of annotate in django query

2021-06-02 Thread Eugene TUYIZERE
in brief, I want to transform this query in django query

[image: image.png]

On Wed, 2 Jun 2021 at 21:56, Eugene TUYIZERE 
wrote:

> Dear Sebatian,
>
> This is what I get:
>
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-03 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-04 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-05 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-06 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-07 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-08 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-09 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-10 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-11 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-12 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-13 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-14 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-15 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-16 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-17 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-18 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-19 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT `crms_customer_requests`.`arrival_date`,
> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
> 2021-05-20 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
> SELECT 

Re: use of annotate in django query

2021-06-02 Thread Eugene TUYIZERE
Dear Sebatian,

This is what I get:

SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-03 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-04 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-05 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-06 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-07 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-08 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-09 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-10 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-11 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-12 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-13 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-14 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-15 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-16 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-17 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-18 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-19 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-20 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT `crms_customer_requests`.`arrival_date`,
COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
`crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
2021-05-21 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
SELECT 

Re: use of annotate in django query

2021-06-02 Thread Sebastian Jung
Hi Eugene,

Please make Print(report.query) then you get SQL querys and Most of time i
get an Idea what's wrong

Regards

Eugene TUYIZERE  schrieb am Mi., 2. Juni 2021,
21:41:

> Dear Team,
>
> I need help. I am working on a project where one of the tables is about
> requests. I want to have a report of the number of requests on each day in
> the last 30 days, something like this:
> [image: image.png]I I used the code below just before displaying on the
> chart but the code gives me wrong information
>
> def reqChart(request):
> current_date = date.today()
> days_before = date.today()-timedelta(days=30)
> for dt in daterange(days_before,current_date):
> reports = Customer_Requests.objects.filter(arrival_date__gte=dt).\
> extra({'day':"date(arrival_date)"}).\
> values('arrival_date').annotate(count=Count('request_name'))
> print(reports)
>
>
> And I need help
> --
> *TUYIZERE Eugene*
>
>
>
> *Msc Degree in Mathematical Science*
>
> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
> Garden-Lime, Cameroon*
>
> Bsc in Computer Science
>
> *UR-Nyagatare Campus*
>
> Email: eugene.tuyiz...@aims-cameroon.org
>eugenetuyiz...@gmail.com
>
> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>
> --
> 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/CABxpZHstWyfMVKQhJb%3DxGKff3p3V%2BFQ_w3DkYVpOe-pEW2ySKg%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/CAKGT9myp4HU6%2BZo6d-JqeaTPsevFBMi_DzU_xuwo3LUja%3DxzRw%40mail.gmail.com.


use of annotate in django query

2021-06-02 Thread Eugene TUYIZERE
Dear Team,

I need help. I am working on a project where one of the tables is about
requests. I want to have a report of the number of requests on each day in
the last 30 days, something like this:
[image: image.png]I I used the code below just before displaying on the
chart but the code gives me wrong information

def reqChart(request):
current_date = date.today()
days_before = date.today()-timedelta(days=30)
for dt in daterange(days_before,current_date):
reports = Customer_Requests.objects.filter(arrival_date__gte=dt).\
extra({'day':"date(arrival_date)"}).\
values('arrival_date').annotate(count=Count('request_name'))
print(reports)


And I need help
-- 
*TUYIZERE Eugene*



*Msc Degree in Mathematical Science*

*African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
Garden-Lime, Cameroon*

Bsc in Computer Science

*UR-Nyagatare Campus*

Email: eugene.tuyiz...@aims-cameroon.org
   eugenetuyiz...@gmail.com

Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38

-- 
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/CABxpZHstWyfMVKQhJb%3DxGKff3p3V%2BFQ_w3DkYVpOe-pEW2ySKg%40mail.gmail.com.


Re: CSS not linking with HTML

2021-06-02 Thread Robert Edward
Plus is it 'syle' or 'style'

On Wed, Jun 2, 2021, 20:26 Robert Edward  wrote:

> You are missing a closing (') when loading style.css
>
> On Fri, May 28, 2021, 21:39 sukhy gill  wrote:
>
>> Dear Frnds
>> I am unable to  link CSS with HTML
>> HTML working but CSS not working inside the .html file with the help of
>> LINK in  tag
>>
>> I am using thefollowings:-
>> Setting.py -  STATICFILES_DIRS=[os.path.join(BASE_DIR, 'static'),]
>> HTML- {% load static %}
>> > 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/3ca2aba0-a58f-4298-b248-16c51bdf90a6n%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/CAH9y-HzVjOtyvFbrnFJ1H7yc-4HF6_ZNrY%2B278ZNQW6%2B0nJm7g%40mail.gmail.com.


Re: CSS not linking with HTML

2021-06-02 Thread Robert Edward
You are missing a closing (') when loading style.css

On Fri, May 28, 2021, 21:39 sukhy gill  wrote:

> Dear Frnds
> I am unable to  link CSS with HTML
> HTML working but CSS not working inside the .html file with the help of
> LINK in  tag
>
> I am using thefollowings:-
> Setting.py -  STATICFILES_DIRS=[os.path.join(BASE_DIR, 'static'),]
> HTML- {% load static %}
>  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/3ca2aba0-a58f-4298-b248-16c51bdf90a6n%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/CAH9y-HwaScq0sVFn5HFkavKaxJ5aY2_LUpcoCtt3dxAnPcXdgA%40mail.gmail.com.


Re: CSS not linking with HTML

2021-06-02 Thread Michael Thomas
I'm guessing you're running a development server (manage.py runserver). I'd
suggest solving this as a two step process:

1) Determine if the request for the static file is actually hitting the
development server or not (eg. if you're running behind a reverse proxy)
2) Fire up your debugger and walk through the code

Django core and related apps (eg. staticfiles) is *extremely* well
documented and easy to read. Walking through the code will get you to the
source of the problem pretty quickly, and you'll probably learn a thing or
two about how Django generally processes requests too, which is invaluable
in the long run.

Kind Regards,
Michael Thomas

On Wed, Jun 2, 2021 at 8:16 PM sukhy gill  wrote:

> Dear  frnd,
>  I am getting stuck at same point with static with new project.
> May I get setting for settings.py ?
>
> Regards
>
> On Sat, May 29, 2021, 18:29 Chelsea Fan  wrote:
>
>> Is it working now?
>>
>> On Sat, 29 May 2021, 3:40 pm lalit suthar, 
>> wrote:
>>
>>> read this https://docs.djangoproject.com/en/2.2/intro/tutorial06/ and
>>> check how you are giving paths. Also after loading the page on your browser
>>> go to "View Page Source" and click on the CSS file link and check if the
>>> file is opening or not.
>>>
>>> On Saturday, 29 May 2021 at 17:57:21 UTC+5:30 sukhy.g...@gmail.com
>>> wrote:
>>>
 Yes Sir,There was no mistake in code. Code problem was only in mail
 content actually code was correct as instruction given by Aniket Sir

 Regards


 On Sat, May 29, 2021, 13:14 lalit suthar >>>
> have you checked Aniket's answer?
>
> On Saturday, 29 May 2021 at 11:09:07 UTC+5:30 sukhy.g...@gmail.com
> wrote:
>
>> Done Sir, but not working
>>
>> On Sat, May 29, 2021, 10:50 Venu Gopal >
>>> In Firefox  Goto Preferences ---> Choose Privacy and Security
>>> ---> scroll down until you get cookies and site data --> clear data
>>> Chrome  Goto Settings ---> Choose Privacy and Security --->
>>> select cookies and other site data --> select see all cookies and site 
>>> data
>>> --> Remove all
>>>
>>> On Sat, May 29, 2021 at 9:50 AM sukhy gill 
>>> wrote:
>>>
 @Venu Gopal

 No Sir, I don't know, how to do this.

 May I know Sir, how to do the same?

 Regards

 On Sat, May 29, 2021, 09:41 Venu Gopal >>>
> Hi, Have you tried deleting existing cache and cookies in the
> browser?
>
> On Sat, May 29, 2021 at 12:08 AM sukhy gill 
> wrote:
>
>> Dear Frnds
>> I am unable to  link CSS with HTML
>> HTML working but CSS not working inside the .html file with the
>> help of LINK in  tag
>>
>> I am using thefollowings:-
>> Setting.py -  STATICFILES_DIRS=[os.path.join(BASE_DIR, 'static'),]
>> HTML- {% load static %}
>> > To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3ca2aba0-a58f-4298-b248-16c51bdf90a6n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to a topic in
> the Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/qGMoFXNAgww/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email
> to django-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOhYkiyqw8k5zCL1XZo9U%2BY9_JR57p55xf-%3DtFf6Fa4HVskPSw%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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAJ8btZave0utnYTAcrxafKes6sUZ3%2BX%2B0v1EGs-pJSF1%2BT4qxw%40mail.gmail.com
 
 .

>>> --
>>> You received this message because you are subscribed to a topic in
>>> the Google Groups "Django users" group.
>>> To 

Re: CSS not linking with HTML

2021-06-02 Thread sukhy gill
Dear  frnd,
 I am getting stuck at same point with static with new project.
May I get setting for settings.py ?

Regards

On Sat, May 29, 2021, 18:29 Chelsea Fan  Is it working now?
>
> On Sat, 29 May 2021, 3:40 pm lalit suthar, 
> wrote:
>
>> read this https://docs.djangoproject.com/en/2.2/intro/tutorial06/ and
>> check how you are giving paths. Also after loading the page on your browser
>> go to "View Page Source" and click on the CSS file link and check if the
>> file is opening or not.
>>
>> On Saturday, 29 May 2021 at 17:57:21 UTC+5:30 sukhy.g...@gmail.com wrote:
>>
>>> Yes Sir,There was no mistake in code. Code problem was only in mail
>>> content actually code was correct as instruction given by Aniket Sir
>>>
>>> Regards
>>>
>>>
>>> On Sat, May 29, 2021, 13:14 lalit suthar >>
 have you checked Aniket's answer?

 On Saturday, 29 May 2021 at 11:09:07 UTC+5:30 sukhy.g...@gmail.com
 wrote:

> Done Sir, but not working
>
> On Sat, May 29, 2021, 10:50 Venu Gopal 
>> In Firefox  Goto Preferences ---> Choose Privacy and Security
>> ---> scroll down until you get cookies and site data --> clear data
>> Chrome  Goto Settings ---> Choose Privacy and Security --->
>> select cookies and other site data --> select see all cookies and site 
>> data
>> --> Remove all
>>
>> On Sat, May 29, 2021 at 9:50 AM sukhy gill 
>> wrote:
>>
>>> @Venu Gopal
>>>
>>> No Sir, I don't know, how to do this.
>>>
>>> May I know Sir, how to do the same?
>>>
>>> Regards
>>>
>>> On Sat, May 29, 2021, 09:41 Venu Gopal >>
 Hi, Have you tried deleting existing cache and cookies in the
 browser?

 On Sat, May 29, 2021 at 12:08 AM sukhy gill 
 wrote:

> Dear Frnds
> I am unable to  link CSS with HTML
> HTML working but CSS not working inside the .html file with the
> help of LINK in  tag
>
> I am using thefollowings:-
> Setting.py -  STATICFILES_DIRS=[os.path.join(BASE_DIR, 'static'),]
> HTML- {% load static %}
>  To unsubscribe from this group and stop receiving emails from it,
> send an email to django-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3ca2aba0-a58f-4298-b248-16c51bdf90a6n%40googlegroups.com
> 
> .
>
 --
 You received this message because you are subscribed to a topic in
 the Google Groups "Django users" group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/django-users/qGMoFXNAgww/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 django-users...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAOhYkiyqw8k5zCL1XZo9U%2BY9_JR57p55xf-%3DtFf6Fa4HVskPSw%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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAJ8btZave0utnYTAcrxafKes6sUZ3%2BX%2B0v1EGs-pJSF1%2BT4qxw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in
>> the Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/qGMoFXNAgww/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> django-users...@googlegroups.com.
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAOhYkiy80sPnGJ2uJPuJODECKv3UfQxATOit%2BwNZnr%3D%2BgiuojQ%40mail.gmail.com
>> 
>> .
>>
> --
 You received this message because you are subscribed to a topic in the
 Google Groups "Django users" group.
 To unsubscribe from this topic, visit
 

Re: Джанго проект

2021-06-02 Thread Chelsea Fan
Антонио Меле " джанго 2 в примерах"

On Wed, 2 Jun 2021, 5:43 pm КОРШУНОВ ГЕОРГИЙ, 
wrote:

> Всем привет, я начинающий разработчик. Где я могу почитать полный,
> подробный гид по использованию фреймворка джанго? Минимум воды, максимум
> эффективной информации, подскажите пожалуйста.
>
> --
> 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/a575b9b8-5bbd-4e42-833d-3d548119294fn%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/CAJwZndeA8fyD%3DjbcSk4oHPnDjMFG-LFZzU9SxPmxWfU78Kn7ww%40mail.gmail.com.


Джанго проект

2021-06-02 Thread КОРШУНОВ ГЕОРГИЙ
Всем привет, я начинающий разработчик. Где я могу почитать полный, 
подробный гид по использованию фреймворка джанго? Минимум воды, максимум 
эффективной информации, подскажите пожалуйста.

-- 
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/a575b9b8-5bbd-4e42-833d-3d548119294fn%40googlegroups.com.


Resolution for #32503

2021-06-02 Thread Omkar D
I am waiting for this https://code.djangoproject.com/ticket/32503 this 
ticket to get resolved. For me it is standing as a blocker for upgrading 
from 2.2 to 3.2.x as my project has many JSON and Textfields.

I expected it to be included in 3.2.4. Just want to know in which version 
this patch can be expected?

-- 
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/b0f78e5c-ace3-4a22-9831-244f2223a28cn%40googlegroups.com.


Re: Where can I work as a freelancer (Django dev)

2021-06-02 Thread Gobi Dasu
Hi Allison, Nikola, and others in this group for whom it is relevant.

We'd love to have you join our talent network of software developers, data
scientists, and designers. Our site is ldtalent.org
 which has some important FAQs. If you
are already strong in your stack you will not need to go through our
vetting / training program. If you could send us your resumé to
i...@learningdollars.com we can start sending you full-time or contract
opportunities for your skillset. You can set your own rate. An additional
perk of LD Talent is that for every skill you learn or passion project you
do on your own, we'll pay you a financial reward just for learning. We also
have an LD Ventures program which invests in and supports developers and
designers launching their own startup ideas as part of LD.

*Regards,*
*Gobi Dasu*  (calendar
)
*Stanford CS **·* *Northwestern HCI*
*LD Talent  *(demo
)


On Tue, Jun 1, 2021 at 5:28 PM Allison Tretina 
wrote:

> I found someone who needed a project and asked them if they’d write me a
> recommendation on completion. Then, I’ve charged a bit for the second
> project. I’ve had to go to clients. Small businesses. They’ve never come to
> me, at least not yet. I served the website on my Raspberry Pi and charged
> for hosting the server and made a bit of money. Users are key. They are the
> goal.
>
> On Tuesday, June 1, 2021, Nikola Pavlovic 
> wrote:
>
>> Hello, I've been learning *Django* for *1 year*. I've made *2 personal
>> projects* for *practice*. But, I'm not *friendly* with the *freelancing
>> process* on the *internet* *yet*.
>> *Any suggestions. Where should I begin?*
>>
>> --
>> 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/d05b3b84-781b-4087-aa20-6bae43665d77n%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/CAJrG93DvzqZpT428muNSdhdSn1Y0H2f_QnarnaARBq4FvQh7rg%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/CAMk8evk39aZXdgkgequUrfkxO1DyRr_7-HxJAURrKfdpTKuxmw%40mail.gmail.com.


Re: SVG widget for the Admin

2021-06-02 Thread Derek
When you say "I tried your suggestion and had no success." what exactly did 
you try  - i.e. what code did you use and what errors did you get?

WRT "Not sure where this should live for the Admin to call it and display 
the image." - it lives exactly as I showed it in my example; its a 
user-defined property for the model in which the SVG text is stored.  You 
can use it in the admin as you would the normal model fields. 

There is a good example of defining and using your own derived 'field'  
here:
https://realpython.com/customize-django-admin-python/#modifying-a-change-list-using-list_display

(Please note that to show HTML strings, you need to use the format_html() 
method. Ignore mt previous reference to "allow_tags" as this is deprecated.)

Derek


On Wednesday, 2 June 2021 at 10:05:11 UTC+2 Mike Dewhirst wrote:

> On 1/06/2021 11:44 pm, Derek wrote:
> > You haven't defined where in the admin interface you want this image 
> > to be displayed?  A table?
> >
> > I have not tried this, but could you not create an additional field on 
> > your model that returns the HTML-encoding needed to display the SVG?
>
> Derek, thanks for responding. I tried your suggestion and had no success.
>
> Where in the admin? Just among a normal roster of fields. The svg is a 
> molecular structure and the image needs to appear for example just after 
> the molecular formula. I collect the actual svg code via a public API on 
> saving the record.
>
> >
> > E.g.
> >
> > class MyModel():
> > svg_text = CharField()
>
> in my case it is ...
>
> class chemical(models.Model):
> ...
> ddstructure = models.TextField(
> null=True,
> blank=True,
> verbose_name="2D structure",
> )
>
> >
> > def _the_svg(self):
> > return """%s""" % 
> > self.svg_text
> > _the_svg.allow_tags = True
>
> Not sure where this should live for the Admin to call it and display the 
> image.
>
>
> > I am not sure about editing visually, however - I would expect that 
> > would require a specialised widget.
>
> It is read-only in all cases.
>
> I was thinking a widget might be needed just for display. The svg code 
> arrives complete with tags so really all it needs is a mechanism to 
> persuade the admin it is safe to render as is.
>
> I haven't seen such a (probably insecure) "feature" previously. I've 
> looked through the docs but haven't found it yet.
>
> Thanks again
>
> Mike
>
>
> >
> > HTH
> > Derek
> >
> >
> > On Tuesday, 1 June 2021 at 03:28:59 UTC+2 Mike Dewhirst wrote:
> >
> > I collect the svg source for an image from a public API and store
> > it in
> > a models.TextField. I have no difficulty displaying it in a normal
> > view
> > and my own template. Nothing special, it just emerges. I don't
> > even need
> > a 'safe' filter.
> >
> > However, I really want to display such images in the Admin. At this
> > stage all it displays is the svg source.
> >
> > What is the correct way to make the image appear in the Admin?
> >
> > Do I need a special field inheriting from TextField? Do I need a
> > special
> > widget? Is there a way to mark admin field values as safe?
> >
> > Thanks for any hints
> >
> > Mike
> >
> > -- 
> > Signed email is an absolute defence against phishing. This email has
> > been signed with my private key. If you import my public key you can
> > automatically decrypt my signature and be sure it came from me. Just
> > ask and I'll send it to you. Your email software can handle signing.
> >
> >
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to django-users...@googlegroups.com 
> > .
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/520bf296-ec68-48ad-8fe2-f106823efac2n%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/520bf296-ec68-48ad-8fe2-f106823efac2n%40googlegroups.com?utm_medium=email_source=footer
> >.
>
>
> -- 
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>
>

-- 
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/518a9b56-de5a-46b8-8578-89bd99f20f4fn%40googlegroups.com.


Re: How to create .exe file of django project ?

2021-06-02 Thread Kasper Laudrup
On 02/06/2021 14.06, Tejas Tendulkar wrote:
> Is there any other way to convert into desktop application ?
>

I would say the short answer is "no". At least not in the way you have
tried so far.

You would probably be able to somehow make the development server run
your code as an executable with something like pyinstaller and then open
the default webbrowser and point it to your locally running web server,
but it doesn't sound like that's what you're after.

Someone else mentioned something about some javascript frameworks
designed for targeting both websites as well as mobile applications and
something like that might work.

I would probably do something like creating a REST API instead (using,
eg. Django Rest Framework) and then create a GUI frontend using
something like PyQT, but of course that very much depends on what your
application is doing.

Kind regards,

Kasper Laudrup

-- 
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/a971ac09-2396-a926-de1e-5849e765b6e7%40stacktrace.dk.


OpenPGP_signature
Description: OpenPGP digital signature


How to create .exe file of django project ?

2021-06-02 Thread Tejas Tendulkar
Hello,I create django website using django and jquery but i want to convert 
into desktop application.I tried pyinstaller but there is some problem with 
pyinstaller.It create exe file but but when i open the exe it open cmd 
promt and close automatically.Is there any other way to convert into 
desktop application ?

-- 
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/b684e02b-8a23-4552-866f-4b1c579ec1c1n%40googlegroups.com.


Re: Migration auth.0011_update_proxy_permissions from Django 2.2 fails to apply

2021-06-02 Thread abhinav
Hi,
@julien  i also encountered this issue did you get a fix for the issue

On Tuesday, April 9, 2019 at 4:08:29 PM UTC+5:30 Julien Enselme wrote:

> @Arpit Singh: I am in a single database setup and we don't use database 
> routers. As far as I know, the migration was never applied before. But from 
> what I understand from you answer, I can --fake it and I should be fine.
>
> @אורי רודברג I tried to update directly from 2.0 to 2.2. Since we 
> switched to 2.1, I just retried to update  to 2.2 and I hit the same issue. 
> The error occurs in the auth_permission table.
>
> > Also, try to install a new - either local or remote - environment with 
> your code and then try to upgrade Django there. There might be a problem 
> specific with this deployment. This exception, on which environment did you 
> receive it? Local or remote?
>
> I happened in my local env. I tried to delete the venv and recreate it 
> from scratch but it didn't help.
>
> I'll try to report the bug.
>
> Thanks for you help!
>
> Julien Enselme
> Développeur chez BureauxLocaux
>
>
> Le lun. 8 avr. 2019 à 13:23, Arpit Singh  a écrit :
>
>> Hi Julien,
>>
>> We faced a similar issue, thought it's probably a bug in Django but 
>> realised that our unique setup of multiple databases is the reason we are 
>> facing this issue unlike many others (except you ofcourse)
>> It turned out that this data integrity issue will pop up if you run this 
>> migration file more than once.
>> .
>> So the thing to keep in mind is that a datamigration files 
>> (0011_update_proxy_permissions is a datamigration file) isn't associated 
>> with any django model, so a faulty router might make it run on all 
>> databases.
>> We hadn't thought of this scenario in our custom django router either.
>> Once we fixed our django router to run only on our target database in 
>> case of a migration file, this problem was resolved.
>>
>> For now, forward migrations in auth app are working fine. Reverse 
>> migrations are still broken though (something to do with apps.get_models() 
>> returning inconsistent results, but that's a problem for another day) 
>>
>> P.S: It would have helped if Django had provided routers with proper 
>> hints though. (
>> https://docs.djangoproject.com/en/2.2/howto/writing-migrations/#data-migrations-and-multiple-databases
>> )
>>
>> On Thursday, April 4, 2019 at 4:38:04 PM UTC+5:30, Julien Enselme wrote:
>>>
>>> Hi,
>>>
>>> I am trying to update my project to Django 2.2 (we are currently on 
>>> 2.0.13). When I launch `python manage.py migrate`, I get this error message 
>>> when migration auth.0011_update_proxy_permissions is applying (full 
>>> stacktrace is available here ):
>>> django.db.utils.IntegrityError: duplicate key value violates unique 
>>> constraint "idx_18141_auth_permission_content_type_id_01ab375a_uniq"
>>> DETAIL:  Key (content_type_id, codename)=(12, add_agency) already exists.
>>>
>>> It looks like the migration is trying to re-create already existing 
>>> entries in the auth_permission table. At first I though it cloud 
>>> because we recently renamed a model. But after digging and deleting the 
>>> entries associated with the renamed model from our database in the 
>>> auth_permission table, the problem still occurs with other proxy models.
>>>
>>> I search for a ticket about this on the bug tracker but found nothing.
>>>
>>> Can someone help me on this? I guess I can keep deleting problematic 
>>> entries from our database one by one but it will take a long time and it 
>>> doesn't look right.
>>>
>>> Regards,
>>> Julien Enselme
>>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/c684e1fc-5fe4-419a-8202-064a25bb5943%40googlegroups.com
>>  
>> 
>> .
>
>
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/9b59a1af-cd1c-496f-b112-3cab9a86cbe6n%40googlegroups.com.


Re: Django developer

2021-06-02 Thread Veera Raj
  veerarajzx10r.pdf



On Wed, Jun 2, 2021, 4:30 PM mah...@gmail.com  wrote:

> Hi
>
> we are looking for a fullstack developer with python, django, javascript,
> css and html experience.
>
> please dm med att mah...@gmail.com and sen us your resume. If you have
> prior experience we would like to se some of your projects before signing a
> contract.
>
> thx
> Theo
>
> --
> 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/beea4eab-f7d1-4298-8342-3a4746e94542n%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/CACg7y8TMLfnLtoF%3DnkQ6N5ZWouzM7PPwe5y9h-HWE8UeYw2QQA%40mail.gmail.com.


I want to hire django developers

2021-06-02 Thread mah...@gmail.com
Hi 

we are looking for a fullstack developer with python, django, javascript, 
css and html experience. 

please email me  mahj...@gmail.com  and send us your 
resumé. If you have prior experience i would like to se some of your 
projects before signing a contract. 

thx
Theo

-- 
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/78fb709d-14a1-4035-aad7-e09137622b4bn%40googlegroups.com.


Django developer

2021-06-02 Thread mah...@gmail.com
Hi 

we are looking for a fullstack developer with python, django, javascript, 
css and html experience. 

please dm med att mah...@gmail.com and sen us your resume. If you have 
prior experience we would like to se some of your projects before signing a 
contract. 

thx
Theo

-- 
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/beea4eab-f7d1-4298-8342-3a4746e94542n%40googlegroups.com.


Django security releases issued: 3.2.4, 3.1.12, and 2.2.24

2021-06-02 Thread Carlton Gibson
Details are available on the Django project weblog: 

https://www.djangoproject.com/weblog/2021/jun/02/security-releases/ 


-- 
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/8712EB7A-190E-402D-A528-5CC2EE84CA91%40gmail.com.


Re: SVG widget for the Admin

2021-06-02 Thread Mike Dewhirst

On 1/06/2021 11:44 pm, Derek wrote:
You haven't defined where in the admin interface you want this image 
to be displayed?  A table?


I have not tried this, but could you not create an additional field on 
your model that returns the HTML-encoding needed to display the SVG?


Derek, thanks for responding. I tried your suggestion and had no success.

Where in the admin? Just among a normal roster of fields. The svg is a 
molecular structure and the image needs to appear for example just after 
the molecular formula. I collect the actual svg code via a public API on 
saving the record.




E.g.

class MyModel():
    svg_text = CharField()


in my case it is ...

class chemical(models.Model):
    ...
    ddstructure = models.TextField(
    null=True,
    blank=True,
    verbose_name="2D structure",
    )



    def _the_svg(self):
        return """%s""" % 
self.svg_text

        _the_svg.allow_tags = True


Not sure where this should live for the Admin to call it and display the 
image.



I am not sure about editing visually, however - I would expect that 
would require a specialised widget.


It is read-only in all cases.

I was thinking a widget might be needed just for display. The svg code 
arrives complete with tags so really all it needs is a mechanism to 
persuade the admin it is safe to render as is.


I haven't seen such a (probably insecure) "feature" previously. I've 
looked through the docs but haven't found it yet.


Thanks again

Mike




HTH
Derek


On Tuesday, 1 June 2021 at 03:28:59 UTC+2 Mike Dewhirst wrote:

I collect the svg source for an image from a public API and store
it in
a models.TextField. I have no difficulty displaying it in a normal
view
and my own template. Nothing special, it just emerges. I don't
even need
a 'safe' filter.

However, I really want to display such images in the Admin. At this
stage all it displays is the svg source.

What is the correct way to make the image appear in the Admin?

Do I need a special field inheriting from TextField? Do I need a
special
widget? Is there a way to mark admin field values as safe?

Thanks for any hints

Mike

-- 
Signed email is an absolute defence against phishing. This email has

been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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/520bf296-ec68-48ad-8fe2-f106823efac2n%40googlegroups.com 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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/4fc10ce8-eccf-8bab-67fb-8dfb93a5b6e2%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Customizable model field (such as SRID for geometries) and migrations

2021-06-02 Thread Olivier Dalang
Dear List,

I'm working on a Django app whose models have geometry fields and that will
be deployed in several geographic locations.

Using a globally available reference system (WGS84) and reprojecting on the
fly will not work due to performance and accuracy implications for
geometric queries. Thus I'd like to make the SRID customizable.

The issue comes with migrations which hard-code the SRID in the CreateModel
statements. I could import an SRID from a variable in settings.py,
but don't like that idea, as changing it after creating would mess things
up (srid mismatch, creating new migrations...). It's actually not really a
django setting, but more related to the data.

One idea would be to store the default SRID in the DB itself (in a
dedicated settings model) and retrieve the SRID dynamically from that
before running the migrations and loading the models. There could even be
some logic to reproject/adapt all geometries fields if the value changes.
Sounds nice, but also complicated (models are not available .

I'm probably not the first one with this type of requirement (could also
happen for other use cases such as language, currencies, etc.). Is there a
package I could use or some design pattern I could follow ?

Thanks !!

Olivier

-- 
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/CAExk7p1s%2B4XozdQOxjZKMbXmG7xq6hhMSiVTsrSyj26VBG%3DFJw%40mail.gmail.com.


Re: best tutorial or guidance for social login(facebook or google) using django allauth and rest auth

2021-06-02 Thread DJANGO DEVELOPER
it is based on social-django but I am using django-allauth.

On Wed, Jun 2, 2021 at 10:58 AM Omkar Parab  wrote:

> try this. 
>
> https://stackoverflow.com/questions/61868629/page-not-found-error-when-adding-facebook-authentication
>
> On Wed, Jun 2, 2021, 11:12 AM DJANGO DEVELOPER 
> wrote:
>
>> actually I am using django-allauth and it doesn't need to have a form to
>> login via facebook.
>>
>> On Wed, Jun 2, 2021 at 10:37 AM Omkar Parab 
>> wrote:
>>
>>> You need to pass csrf_token using  tag or via JS.
>>>
>>> On Wed, Jun 2, 2021, 10:53 AM DJANGO DEVELOPER 
>>> wrote:
>>>
 it is working now but giving the errors attached in the photo.  when I
 click on send anyway, then it shows error of csrf forbidden. I am getting
 confused again and again.

 On Wed, Jun 2, 2021 at 10:18 AM Omkar Parab 
 wrote:

> Yes.
>
> On Wed, Jun 2, 2021, 10:12 AM DJANGO DEVELOPER <
> abubakarbr...@gmail.com> wrote:
>
>> do have I to add ngrok url in my facebook app that I created to get
>> client secret?
>>
>> On Wed, Jun 2, 2021 at 9:40 AM DJANGO DEVELOPER <
>> abubakarbr...@gmail.com> wrote:
>>
>>> oh, I had to run the local server first. it is running successfully
>>> but giving the same error of urls.
>>>
>>> On Wed, Jun 2, 2021 at 9:36 AM DJANGO DEVELOPER <
>>> abubakarbr...@gmail.com> wrote:
>>>
 The connection to https://d0f7dea89f18.ngrok.io was successfully
 tunneled to your ngrok client, but the client failed to establish a
 connection to the local address localhost:8000.
 facing this error

 On Wed, Jun 2, 2021 at 9:30 AM Omkar Parab 
 wrote:

> Run "ngrok.exe http 8000" command in ngrok terminal.
>
>
> On Wed, Jun 2, 2021, 9:23 AM DJANGO DEVELOPER <
> abubakarbr...@gmail.com> wrote:
>
>> let suppose I have installed ngrok, then should have I to run
>> command of ngrok.exe in project's directory or anywhere?
>>
>> On Wed, Jun 2, 2021 at 8:39 AM Omkar Parab 
>> wrote:
>>
>>> Facebook login won't work with these local URLs. Only google
>>> login will work. Don't waste your time. Either host it on Heroku or 
>>> install
>>> ngrok and try again.
>>>
>>> On Wed, Jun 2, 2021, 7:16 AM DJANGO DEVELOPER <
>>> abubakarbr...@gmail.com> wrote:
>>>
 and last settings of my developer app

 On Wed, Jun 2, 2021 at 6:44 AM DJANGO DEVELOPER <
 abubakarbr...@gmail.com> wrote:

> site url from my app.
>
> On Wed, Jun 2, 2021 at 6:43 AM DJANGO DEVELOPER <
> abubakarbr...@gmail.com> wrote:
>
>> I have 2 sites in my django admin side. one is localhost:8000
>> and other is 127.0.0.1:8000
>>
>> On Wed, Jun 2, 2021 at 1:05 AM Kasper Laudrup <
>> laud...@stacktrace.dk> wrote:
>>
>>> On 01/06/2021 21.49, DJANGO DEVELOPER wrote:
>>> > I am using django-allauth library and i am following this
>>> > tutorial.
>>> https://medium.com/geekculture/setup-social-authentication-in-django-rest-framework-1afdb675375f
>>> > <
>>> https://medium.com/geekculture/setup-social-authentication-in-django-rest-framework-1afdb675375f
>>> >
>>> >
>>>
>>> You've said so already, but at least now you've posted an
>>> error message.
>>>
>>> What's the URL you're trying to load and what's currently in
>>> the "App
>>> Domains" field in your app settings?
>>>
>>> Kind regards,
>>>
>>> Kasper Laudrup
>>>
>>> --
>>> 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/948b7758-8ec1-ffe6-4857-9b49fb758965%40stacktrace.dk
>>> .
>>>
>> --
 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/CAKPY9pktmf8am%3D3OioHua027_4u-fSa5OqgVHwyro%3DZpT-bJVA%40mail.gmail.com