I have a Django site in which the site admin inputs their Twitter Username/Password in order to use the Twitter API. The Model is set up like this:
class TwitterUser(models.Model):
screen_name = models.CharField(max_length=100)
password = models.CharField(max_length=255)
def __unicode__(self):
return self.screen_name
I need the A...
I am working through the Django tutorials, and now I am at creating a poll.
The code below works fine until I want to create choices, where for some reason I always get this error message:
line 22, in __unicode__
return self.question
AttributeError: 'Choice' object has no attribute 'question'
What am I doing wrong?
Here's my code...
Is this a valid function pointer code below,
In views ,
def change(request):
dict={}
function_ptr="create()"
dict.update({'function_ptr' : function_ptr})
return render_to_response('mpjt/create.html',context_instance=RequestContext(request,{'dict': dict}))
In create.html
$(document).ready(func...
I am displaying a django widget, with which I need to display additional information (something like a tool tip) that is attendant to the widget. I essentially have a widget that asks a random question, which is self contained.
{{ form.fieldname }}
displays the full widget which looks something like (à la the widget's render method):...
Hi,
I have extended Django's User Model using a custom user profile called UserExtension.
It is related to User through a unique ForeignKey Relationship, which enables me to edit it in the admin in an inline form!
I'm using a signal to create a new profile for every new user:
def create_user_profile(sender, instance, created, **kwargs):...
This is are my models i want to relate. i want for collection to appear in the form of occurrence.
class Collection(models.Model):
id = models.AutoField(primary_key=True, null=True)
code = models.CharField(max_length=100, null=True, blank=True)
address = models.CharField(max_length=100, null=True, blank=True)
collection_...
what Im looking to do is to have a link on the name of a field of a model. So when im filling the form using the admin interface i can access some information.
I know this doesn't work but shows what i want to do
class A(models.Model):
item_type = models.CharField(max_length=100, choices=ITEMTYPE_CHOICES, verbose_name="<a href='htt...
Has anyone made Django work with myconnpy?
I've checked out http://github.com/rtyler/connector-django-mysql but
the author said it's very outdated and not supported.
If you've managed to make Django work with myconnpy, please share your
experience.
Thanks.
...
Lets say i have a model A. Then, i have several models B, C, D, E etc that each have a foreignKey to model A. I know that i can set B, C, D etc as inlines to model A so that when i create a model A it will show formsets for adding multiple items for each subModel, but i think this would make a fairly cluttered and very large page.
I...
I'm in the process of re-setting up my Django development environment after reinstalling my OS. We use django-photologue with our project, which I installed using easy_install. However, I'm getting a template error on every template that has a photologue photo:
TemplateSyntaxError at /newsroom/news/
Caught an exception while render...
I would like to create small project using django and pyjamas. I tried googling for some solution on how to merge those two, but I found only projects using some external libraries using json services. Could anyone give me some advice on how to build such project so I wouldn't have to use them? I would like to use django auth system, but...
I'm using PyDev with Django. The autocomplete works nicely in the shell - I start typing, and it suggests completions. However, this doesn't work in the main code editor window. How can I fix this?
I'm using:
Eclipse build #20100218-1602
PyDev 1.5.6
Eclipse IDE for Java Devs 1.2.2
...
Say I want to model a system where a piece of data can have multiple tags (e.g. a question on a StackOverflow is the data, it's set of tags are the tags). I can model this in Django with the following:
class Tag(models.Model):
name = models.CharField(10)
class Data(models.Model):
tags = models.ManyToManyField(Tag)
Given a set...
This might be a newbie question for Hudson. I am trying to setup Selenium testing for my Django website in my Hudson CI server. The question is, the Hudson will use subversion to checkout my Django code into its own path, how do I "deploy" the code into the same server for testing? This is not a question about deploying django, but inste...
I'm new to Django and have some code in my views.py like this:
try:
myfunction()
except:
assert False, sys.exc_info()[0]
This is very helpful because I get an email with lots of useful info if there's an error.
The problem is that it also redirects the user to a Webfaction system error page. What I'd like to know is how do I s...
Hi, I've set up django-sphinx in my project, which works perfectly only for some time. Later it always returns empty result set. Surprisingly restarting django app fixes it. And search works again but again only for short time (or very limiter number of queries). Heres my sphinx.conf:
source src_questions
{
# data source
type ...
Using Django 1.1.1
In models.py:
class Site(models.Model):
name = models.CharField(max_length=50)
class SiteMonth(models.Model):
site = models.ForeignKey(Site)
timestamp = models.DateTimeField()
parameter1 = models.IntegerField()
....
In site_view.py:
#form for selecting which site to analyse
class SiteForm(form...
I'm trying to get the generic views for a date-based archive working in django.
I defined the urls as described in a tutorial, but django returns a 404 error whenever I want to access an url with a variable (such as month or year) in it. It don't even produces a TemplateDoesNotExist-execption. Normal urls without variables work fine.
He...
Hello,
I have a problem when upgrading a django and mysql app with south.
I've tried to make a sql-based upgrade with the code generated by the django sqlall command and I have a similar problem.
Here is the sql code:
CREATE TABLE `programmations_basissupport` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`value` numer...
So now I am still at the Django tutorial part 3:
http://docs.djangoproject.com/en/1.1/intro/tutorial03/#intro-tutorial03
Trying to set up the urls.py with this piece of code provided by the tutorial
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^polls/...