Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Dan Madere
I tried out the example code, and can replicate this. What's interesting is that if I try removing the ContactConnection model, and the "through" attribute, this allows Django to create the intermediate table on its own, and then your get_connections() method works as expected! It seems like us

Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Dan Madere
I don't know of a way to configure the admin do that, but one solution would be to use signals to notice when one-way records are created, then automatically create the record for reverse relationship. We need to notice when records are deleted as well. This approach would allow showing one inl

Re: Django queryset filtering

2020-06-26 Thread Dan Madere
I'd make two queries. One to see which businesses currently have active licenses, then a second to get the expired licenses, excluding the businesses from the first query. Here's some example code, assuming the LicenseIssue model has a "business" foreign key field: *active_business_ids = Licen

Re: Django ContentTypes required?

2020-07-06 Thread Dan Madere
I agree that it should work. Django uses ContentType in the admin and user authentication, but you mention that you have removed these from INSTALLED_APPS, so I don't get it. I'd try clearing .PYC files first. Then maybe a sanity check.. double check what settings file you're actually using, an

Re: POSTGRES CONNTECTION TIMEOUT WHEN USING AN API

2020-07-06 Thread Dan Madere
Sounds like nginx is timing out waiting for Django, due to the slow query. You can set proxy_connect_timeout and proxy_read_timeout in your nginx config to allow it to wait longer. Another approach would be to optimize the SQL query and add indexes, to have the query run faster and not cause th