What do you want to save?
Add Code snippet
New code examples
-
-
Other 2022-03-10 06:30:02
store your sesitive info in virtual env
$ pip install django-environ Add solution -
Python 2022-03-06 22:55:12
image url django
This setup is working for me, maybe it will help you. It is for latest version of Django. Many answers in OS are for older Django versions. URLS: urlpatterns = [ #url ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) Settings: MEDIA_ROOT... Add solution -
Python 2022-03-06 11:20:03
django set form field value in template
This was a feature request that got fixed in Django 1.3. Here's the bug: https://code.djangoproject.com/ticket/10427 Basically, if you're running something after 1.3, in Django templates you can do: {{ form.field.value|default_if_none:"" }} O... Add solution -
Python 2022-03-02 20:05:31
q is not defined pylance django
from django.db.models import Q Add solution -
-
Other 2022-03-01 16:45:21
how to write manual querry in drf
from django.db import connection def my_custom_sql(self): with connection.cursor() as cursor: cursor.execute("UPDATE bar SET foo = 1 WHERE baz = %s", [self.baz]) cursor.execute("SELECT foo FROM bar WHERE baz = %s",... Add solution
Best helpers
Ranking is empty