I have a Django model:
class Customer(models.Model):
first_name=models.CharField(max_length=20,null=True, blank=True)
last_name=models.CharField(max_length=25,null=True, blank=True)
address=models.CharField(max_length=60,null=True, blank=True)
address2=models.CharField(max_length=60,null=True, blank=True)
city=models.CharField...
Hello everyone,
I have a formset that is setup to use a join table. The join table
joins a Recipe table and an Ingredient table and looks like thus
class RecipeIngredient(models.Model):
'''intermediate model between Ingredient and recipe.models.recipe
for many to many'''
quantity = models.IntegerField()
measurement ...
I just installed the Python Django and Django Templates bundles in Textmate. However, the tag triggers dont seem to work. I opened up a .py file and wrote manytomany and pressed tab and it didnt autocomplete.
When i click on it manually from the menu bar it works fine. Am I forgetting something? Do bundles need to be activated somehow?
...
Django version 1.1.1
I have a custom dashboard view set up to override the django admin
default like:
(r'^admin/$', 'dashboard.views.dashboard'),
(r'^admin/', include(admin.site.urls)),
dashboard view authenticates with the @staff_member_required decorator
This has been working fine with all users having superuser permissions
but whe...
Hi,
I keep getting this error on my views. I can't work it out as the code is similar to the djangos tutorial just changing the objects name. Here is the code for my views.py:
from django.http import HttpResponse
from django.template import Context, loader
from django.shortcuts import render_to_response
from astonomyStuff....
For instance, I have a field in a model class called Role, and instead of creating a separate Role model by hand, that I then later have to write code to populate with 5 known values, is there a way to express that the Role field in my Person model can only hold those 5 known values?
...
Is it possible to pass more than 1 argument to a context processor in Django? In other words, in addition to the HttpRequest object, I would like to pass 1 or more additional argument?
...
I'm trying to use directeur's Django-sorting in a modelformset. My template code looks like this:
{% load sorting_tags %}
<table style="text-align: left;" border="1" cellpadding="5" cellspacing="0">
{% autosort formset.forms %}
{% for form in formset.forms %}
{% if forloop.first %}
<tr>
{% for field in form %}
...
I'm trying to add the comments framework to a weblog I'm creating in Django. Adding the comments system appears to be working fine until I attempt to enable comment moderation.
I add the following code to my models.py as per the instructions on the above link. My model is called Post which represents a post in the weblog.
class PostMod...
Hi,
I have created a form class which is used to generate a formset. I can easily generate the formset with initial data in it. However, I need to write the value of one of my CharField elements in my form as the label for another field. In order to do get this dynamic name, I wrote {{ form.field }} as the value for label. But since fie...
I have put together a form to save a recipe. It makes use of a form and an inline formset. I have users with text files containing recipes and they would like to cut and paste the data to make entry easier. I have worked out how to populate the form portion after processing the raw text input but I cannot figure out how to populate th...
Just wondering because at the moment I am keeping the ImageFields as part of the BlogPost model. If I want to support the potential for 20 images, I have 20 such fields, when often almost 19 of them will never be used. But if I normalize them into a separate model, it's not as intuitive to add images to a post in the admin page, since yo...
Hi, I'm struggling with something that I am sure has a very simple method, but I am not getting it right. I am trying to pass a value from the urlconf to the feeds.py file. What I am trying to do is generate specific feeds for comments on a page.
I have been reading the example in the documentation:
http://docs.djangoproject.com/en/d...
I'm trying to achieve some extra select on a queryset and wants to add the needed table to the pool of tables in the query using the select_related method in order to benefit for the '__' syntax.
Here is an example with simple models :
from django.db import models
# Create your models here.
class testA(models.Model):
code = model...
hello, after running "python manage.py syncdb" i gett an error saying "unable to open database file".
here is the important part from my settings.py:
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'apps.db' # Or path to database file if using sqlite3.
DATABASE_...
Hi,
I have a data model in django called MainData which was created on top of a table called "my_data".
I want to perfom a simple calculation on top of this table via django API. The query is as follow:
select main.id,
sum(main.num - secondary.num) as result
from (select * from my_data
where some_value >...
My Apache2 log is spitting out these errors on my Ubuntu 10.04 server. When I hit the server I get Internal 500 Errors and the log has this:
[Mon Jul 19 07:40:11 2010] [error] [client 192.168.1.152] File "/usr/local/lib/python2.6/dist-packages/django/utils/dateformat.py", line 281, in format
[Mon Jul 19 07:40:11 2010] [error] [client ...
Hi,
anyone know if there's a django database debugging app which supports Django's multi-db API?
I used to use django-debug-toolbar but it doesn't support multiple databases and the corresponding ticket is now open for 3 months.
Are there any alternatives worth looking at?
...
I am wondering if someone has researched how much overhead the Django framework will introduce in compare of Google App Engine's simple web framework?
I am planning run some tests and figure out what's the overhead look like and hopefully find out if it has significant impact for an application with the data store (since data store will...
I've found myself unsatisfied with Django's ability to render JSON data. If I use built in serializes then database foreign key relationships are not included in the data (only the keys). Also, it seems to be impossible to include custom data in the json feed that isn't part of the model being serialized.
As a test I implemented a tem...