I have a model which contains a ManyToMany to User to keep track of which users have 'favorited' a particular model instance.
In my API for this model, when requested by an authenticated user, I'd like to include an 'is_favorite' boolean. However, it seems that any api fields that aren't straight model attributes must be implemebted as ...
I want a user to be able to upload a video from their computer or record it right from their webcam, then fill out other information with a form. I'm writing this app with Django.
...
In Django I have theses models:
class Artist(models.Model):
name = models.CharField(max_length=128)
born_place = models.ForeignKey(???)
dead_place = models.ForeignKey(???)
live_places = models.ManyToManyField(???)
work_places = models.ManyToManyField(???)
class Country(models.Model):
iso = models.CharField(max_l...
Hi,
I've added a MultivaluedField to my index (haystack), I need to search for a ManyToMany related field, but it doesn't work.
The engine is WHOOSH.
This how my index looks like:
class PostIndex(SearchIndex):
text = CharField(document=True, use_template=True)
author = CharField(model_attr='author')
body = CharFiel...
I'm using the following django/python code to stream a file to the browser:
wrapper = FileWrapper(file(path))
response = HttpResponse(wrapper, content_type='text/plain')
response['Content-Length'] = os.path.getsize(path)
return response
Is there a way to delete the file after the reponse is returned? Using a callback function or somet...
Assuming that I have such model
COLORS= (
('R', 'Red'),
('B', 'Yellow'),
('G', 'White'),
)
class Car(models.Model):
name = models.CharField(max_length=20)
color= models.CharField(max_length=1, choices=COLORS)
It displays as a selectbox in the admin panel however I would like my admin-user to multi select those colo...
Does anyone out there have any great ideas to achieve a massively scalable hierarchical datastore? It needs rapid add and ability to have many users of site requesting reports on the number of nodes below a certain node in hierarchy.
This is the scenario....
I will have a very large number of nodes getting added per hour. Lets say I w...
Hi there,
Simple question.
How can I pass a variable from the URL to the view? I'm following the Date Example.
My view needs to arguments:
def hours_ahead(request, offset):
My url.py has this"
(r'^plus/\d{1,2}/$', hours_ahead),
I know I need to pass another argument through but I don't know how to get the number from the URL st...
I have a request to alter a standard Django login of email and password to allow any user login without a password, but only if they are on a certain domain ... e.g. [email protected] ... where the user is allowed in due to them being on the correct domain.
Any suggestions?
Thanks
...
How do I refresh a certain element within a django template?
Example:
{% if object.some_m2m_field.all %}
<h3>The stuff I want to refresh is below</h3>
<div id="the-div-that-should-be-refreshed">
{% for other_object in object.some_m2m_field.all %}
<a href="www.example.com">{{ other_object.title }}</a>
...
I have this class
class Category(models.Model):
title = models.CharField(max_length=60)
created = models.DateTimeField()
def __unicode__(self):
return self.title
class Meta:
verbose_name_plural = "Categories"
I can access its items using Category.objects.all() from my views.py.
I want to access these items inside my ...
I came across this tutorial:
http://thomas.broxrost.com/2008/04/08/django-on-google-app-engine/
Fantastic!
Everything worked.
I just did not fully understand the code below because in comparison to Django it seems different:
views.py:
def main(request):
visitor = Visitor()
visitor.ip = request.META["REMOTE_ADDR"]
visi...
Appengine has the handlers and Django the urls.py:
How can/should I match these two, to get the best result?
Can I/How can I pass all the requests that com to www.mysite.com to the urls.py?
What is best for the performance?
Just in case someone was wondering. This is what I was looking for:
"Tip: App Engine routes requests to Python ...
Greetings
I want to slugify/normalize utf8 string however I get
# -*- coding: utf-8 -*-
from django.template.defaultfilters import slugify
print slugify( unicode("şşşşüüüüççç") )
and get result as "ssssuuuccc", however I get UnicodeDecodeError 'ascii' codec cant decode ... error.
...
Hi,
I tried to install django on my apache on mod_wsgi ,
I have this error : ImportError: No module named django.core.handlers.wsgi,
I v read, may be it's some user problem...
On console ssh, with root access no problem to access django.core.handlers.wsgi , but when apache ask to access it doesn't work... i need help Thx
My django....
When saving an object in the Django admin I get this error, UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 63: ordinal not in range(128)
my database is unicode (postgres) The object being saved has some french characters. I have never had issues before saving objects when I was using MySQL.
...
I have a project which has a directory setup like:
myproject
someapp
sites
foo
settings.py - site specific
settings.py - global
I am using twisted web.wsgi to serve this project. The problem am I running into is setting up the correct environment.
import sys
import os
from twisted.application import internet, s...
I've got a dango webform from a model with some error checking (valid email field,etc).
Everything works fine in variopus browsers Opera,Camino,Netscape,Safari and IE (except IE7).
All I get in IE7 is the 'Internet Explorer cannot display the webpage' message. If the forms valid the data gets written to the database so I think its somet...
I'm using Python/Django, but this is more about the "data model" and how I interact with the information - I really just want to know if I'm crazy here.
I'm working on a small app at my company (~55 employees) that will keep track of available Vacation/Sick time. Part of the purpose is to integrate "self-service" into our intranet, so ...
Hello, I'm a Django newbie and am interesting in understanding how to install the EmailAuth app into my new project:
http://github.com/redvasily/django-emailauth
Seems like Django apps are meant to be plug in play so I must be missing something....
Here's what I tried.
I created a new project
copied the emailauth directory over
Updat...