Skip to content

Tag: django

Django-queryset join without foreignkey

model.py What I want is to get id_noga where dzienrok=1234. I know that dziens should be but it isn’t and I can’t change that. Normally I would use something like but I don’t know how to join and filter those tables without foreignkey. Answer It’s possible to join two tables by perform…

Python Django send_mail newlines?

I’m using django send_mail like this: Gmail recieves this. And shows my newlines as one whole paragraph. Why? I would like three lines of text, not one. Answer Try sending your email as HTML instead of plain text. Use EmailMessage().

Django Simple Captcha image size

How can I change captcha image size and text padding in image? I read official docs and havn’t found any of those. Answer I have never used this app, but I’ve found in code something: So if you call captch_image with additional paramater scale, you can change the size. If you use urls for this app…

GeoDjango GEOSException error

Trying to install a GeoDjango on my machine. I’m really new to Python and being brought into a project that has been a very tricky install for the other team members. I installed Python 2.7 and GEOS using brew, and running PSQL 9.2.4 but keep getting this error when I try to get the webserver running: C…

Django Queryset Filter Missing Quotes

I have a list and I want to filter my Queryset when any of these items is found in a foreign table’s non-primary key ‘test’. So I write something like this: This returns an empty list. When I look at the SQL query it generated, I get: Whereas what it should have been is this: Without the quo…