hey,
i wanna send emails in html template like this.
<html>
<body>
hello <strong>{{username}}</strong>
your account activated.
<img src="mysite.com/logo.gif" />
</body>
it means, i want to send fully html powered templates, with django datas.
i cant find anything about send_mail, and django-mailer only sends…
I'd like to know how can I sort values in the Django admin dropdowns. For example, I have a model called Article with a foreign key pointing to the Users model, smth like:
class Article(models.Model):
title = models.CharField(_('Title'), max_length=200)
slug = models.SlugField(_('Slug'), unique_for_date='publish')
…
I seem to have run into a strange bug or more likely some setting I am unfamiliar with on my system that is not allowing me to tab when I am in Django's shell (python manage.py shell is how I run it).
For obvious reasons this is proving to be annoying since I can't do any loops or conditonals in the shell. If I hit tab it completes all functions…
I'm trying to sync my db from a view, something like this:
from django import http
from django.core import management
def syncdb(request):
management.call_command('syncdb')
return http.HttpResponse('Database synced.')
The issue is, it will block the dev server by asking for user input from the terminal. How can I pass it the…
One of my django models has a large TextField which I often don't need to use. Is there a way to tell django to "lazy-load" this field? i.e. not to bother pulling it from the database unless I explicitly ask for it. I'm wasting a lot of memory and bandwidth pulling this TextField into python every time I refer to these objects.
The…
Hi all,
I would like to figure out where everything is in django admin. Since i am currently trying to modify the behavior rather heavily right now, so perhaps a reference would be helpful. For example, where is ModelAdmin located, i cannot find it anywhere in C:\Python26\Lib\site-packages\django\contrib\admin. I need that because i…
In django how to check whether any entry exists for a query
sc=scorm.objects.filter(Header__id=qp.id)
This was how it was done in php
if(mysql_num_rows($resultn))
{
}
else
{
}
I know that HttpResponseRedirect only takes one parameter, a URL. But there are cases when I want to redirect with an error message to display.
I was reading this post: How to pass information using an http redirect (in Django) and there were a lot of good suggestions. I don't really want to use a library that I don't know how…
Hi folks...I have a dictionary with embedded objects, which looks something like this:
notes = {
2009: [<Note: Test note>, <Note: Another test note>],
2010: [<Note: Third test note>, <Note: Fourth test note>],
}
I'm trying to access each of the note objects inside a django template, and having a…
Django has very good documentation that describes how to write custom database fields and custom template tags and filters. I cannot find the document that describes how to write custom form fields and widgets. Does this document exist?
The way I've been able to write custom form fields and widgets is by reading the Django…
Is there a way to display User fields under a form that adds/edits a UserProfile model? I am extending default Django User model like this:
class UserProfile(models.Model):
user = models.OneToOneField(User, unique=True)
about = models.TextField(blank=True)
I know that it is possible to make a:
class…
Django has very good documentation that describes how to write custom database fields and custom template tags and filters. I cannot find the document that describes how to write custom form fields and widgets. Does this document exist?
The way I've been able to write custom form fields and widgets is by…
Hi all,
I'm trying to get an abstract model working in Django and I hit a brick wall trying to set the related_name per the recommendation here: http://docs.djangoproject.com/en/dev/topics/db/models/#be-careful-with-related-name
This is what my abstract model looks like:
class CommonModel(models.Model):
…
I have a test django app.
In one page the test show the same question to all users.
I'd like that when a user answers correctly, send a signal to other active user's browser to refresh to the next question.
I have been learning about signals in django I learning work with them but I don't now how send…
This might be an isolated problem, but figured I'd ask in case someone has thoughts on a graceful approach to address it.
Here's the setup:
--------
views.py
--------
from django.http import HttpResponse
import shortcuts
def mood_dispatcher(request):
mood = magic_function_to_guess_my_mood(request)
…
Hi, all.
I am using django.forms.Form to validate form data in a survey applications.
In a survey-creating form, a user can submit multiple questions that belong to the survey being created.
Names for the question inputs are in the form of 'question_seq' , where seq is maintained using Javascript.
…
class Product(models.Model):
...
image = models.ImageField(upload_to = generate_filename, blank = True)
When I use ImageField (blank=True) and do not select image into admin form, exception occures.
In django code you can see this:
class FieldFile(File):
....
def…
I may be loading data the wrong way.
excerpt of data.json:
{
"pk": "1",
"model": "myapp.Course",
"fields":
{
"name": "Introduction to Web Design",
"requiredFor": [9],
"offeringSchool": 1,
"pre_reqs": [],
"offeredIn": [1, 5, 9]
…
I am looking to sort the related objects that show up when editing an object using the admin form. So for example, I would like to take the following object:
class Person(models.Model):
first_name = models.CharField( ... )
last_name = models.CharField( ... )
hero =…
I've found a few questions here related to my issue, but I haven't found anything that has helped me resolve my issue. I'm using Python 2.7.5 and Django 1.8.dev20140627143448.
I have a view that's interacting with my database to delete objects, and it takes two arguments in…
I have just started to integrate django_digest into my app. As a start I have added the @httpdigest decorator to one of my views.
If I try to connect to it I get a KeyError exception thrown in django_digest/backend/db.py . Depending on which db I configure I get a different…
I'm using the Windows Launcher development environment for Google App Engine.
I have downloaded Django 1.1.2 source, and un-tarrred the "django" subdirectory to live within my application directory (a peer of app.yaml)
At the top of each .py source file, I do this:
import…
We're looking for a good place to host our custom Django app (a fork of OSQA) and its postgresql backend. Requirements include:
Linux
Python 2.6 or (ideally) Python 2.7
Django 1.2
Postgres 8.4 or later
DB backup/restore handled by the hoster, not us
OS &…
Hi all,
I'm trying to rewrite all requests for my Django server running on apache+WSGI ( inside my local network) and configured as the WSGI's wiki how to, except that I set a virtualhost for it.
The server which from I want to rewrite requests is another…