Re: Combining two subquery counts using ORM

2022-11-09 Thread Matthew Hegarty
Post your model here and we do it > > On Wed, Nov 9, 2022, 7:37 PM Matthew Hegarty wrote: > >> My question is about translating a SQL query to the ORM. >> >> I want to combine the output of two queries into one. The query is >> counting records in the same table

Combining two subquery counts using ORM

2022-11-09 Thread Matthew Hegarty
My question is about translating a SQL query to the ORM. I want to combine the output of two queries into one. The query is counting records in the same table (Task) using two different fields. The query is: select q1.taskname, q1.count, q2.count, (q1.count + q2.count) as total from ( select

Re: @cache_control decorator fails after update to 4.0.5

2022-06-22 Thread Matthew Hegarty
OK, silly me. I should have paid more attention to the message. This fixes it: @method_decorator(cache_control(max_age=60 * 60 * 24, immutable=True, public=True), name='dispatch') On Wednesday, 22 June 2022 at 12:51:18 UTC+1 Matthew Hegarty wrote: > Hi All > > I'm upgrading to 4

@cache_control decorator fails after update to 4.0.5

2022-06-22 Thread Matthew Hegarty
Hi All I'm upgrading to 4.0.5 from 3.2.13 My integration test fails: class FaviconTests(SimpleTestCase): def test_get(self): response = self.client.get("/favicon.ico") self.assertEqual(response.status_code, HTTPStatus.OK) self.assertEqual(response["Cache-Control"],

Re: datetime_safe deprecation

2021-08-02 Thread Matthew Hegarty
ticket is here <https://code.djangoproject.com/ticket/32738> On Sunday, 1 August 2021 at 14:09:24 UTC+1 Matthew Hegarty wrote: > I note that `datetime_safe` is to be removed in Django 5.0 > <https://docs.djangoproject.com/en/dev/internals/deprecation/#deprecation

datetime_safe deprecation

2021-08-01 Thread Matthew Hegarty
I note that `datetime_safe` is to be removed in Django 5.0 . This module fixed the issue with the date padding for years < 1000, however this issue still remains .

Re: Sometimes get "incorrect padding error"- new bug in django 3.1?

2020-08-18 Thread Matthew Hegarty
Raised a ticket <https://code.djangoproject.com/ticket/31895> The only workaround is to truncate the django_session table. (clearsessions <https://docs.djangoproject.com/en/3.0/ref/django-admin/#django-contrib-sessions> did not work) On Mon, 17 Aug 2020 at 21:24, Matthew Hegarty w

Re: Sometimes get "incorrect padding error"- new bug in django 3.1?

2020-08-17 Thread Matthew Hegarty
Hey Diptesh - did you get anywhere with understanding this? Did y ou get any response from the Django devs? Just happened to me on my Staging site. Recently upgraded from 3.0 to 3.1 I can login with Firefox, but Chrome crashes with the following error: ```python Internal Server Error: /home/

possible bug: test loader fails if models/__init__.py defined

2019-05-08 Thread Matthew Hegarty
Hi I have imported my model classes in models/__init__.py (as described in docs ): You must define or import all models in your application’s models.py or > models/__init__.py. Otherwise, the application