So, I have this Django application and I keep adding new features to provide ever more granular views of the data. To give a quick idea of the problem, here's a subset of urls.py:
# Simple enough . . .
(r'^$', 'index'),
(r'^date/(?P<year>\d{4})$', 'index'),
(r'^date/(?P<year>\d{4})-(?P<month>\d{2})$', 'index'),
(r'^date/(?P<year>\d{4})...
Possible Duplicate:
In a django form, How to make a field readonly (or disabled) so that it cannot be edited?
I am making a production server in django admin where I have an integerfield
available = models.IntegerField(blank=True, help_text="(updated on save)")
I was wondering if I could make this a readonly field that wont...
I'm trying to send a django email with UTF-8 characters in the template, specifically:
S'il vous plaît
I get the error:
UnicodeDecodeError: 'utf8' codec can't decode byte 0x94 in position 147: unexpected code byte
When trying to encode the special "î" character (that is the character at that position.)
Here is my code for genera...
I am writting a django app and Iphone app, I need to keep them in sync.
Users can delete, update and create new objects in the web app, and in the iphone app.
When they get online with the iphone both app must be in sync.
Is there simple way to do this?
Thanks,
Joaquin
...
Hi everybody!
First of all I'm a python newbie.
I'm playing with Django and I'm trying to extend some classes.
Now I'm in this situation:
I have a new class
customBaseModelAdmin(admin.options.BaseModelAdmin):
#override a method of BaseModelAdmin
and I want to write another class
customModelAdmin(customBaseModelAdmin):
that...
I'm getting the error:
Exception Value: (1110, "Column 'about' specified twice")
As I was reviewing the Django error page, I noticed that the customizations the model User, seem to be appended to the List twice.
This seems to be happening here in django/db/model/base.py in base_save():
values = [(f, f.get_db_prep_save(raw and get...
I've never written any tests in my life, but I'd like to start writing tests for my Django projects. I've read some articles about tests and decided to try to write some tests for an extremely simple Django app or a start.
The app has two views (a list view, and a detail view) and a model with four fields:
class News(models.Model):
...
I have two abstract models:
class Createable(models.Model):
createLog = models.ForeignKey(ActionLog, related_name="%(app_label)s_%(class)s_create_action_log")
class Meta:
abstract = True
class Deleteable(models.Model):
deleteLog = models.ForeignKey(ActionLog, related_name="%(app_label)s_%(class)s _delete_action_...
I am applying the 'url' template tag to all links in my current Django project.
I have my urls named like so...
url(r'^login/$', 'login', name='site_login'),
This allows me to access /login at my site's root. I have my template tag defined like so...
<a href="{% url site_login %}">
It works fine, except that Django automatically ...
In LINQ (I come from a C# background), you can manually load data for related tables via the Include("xxx") method
from a in ctx.MainTable.Include("SubTable")
select a;
In the above code, every instance of MainTable is loaded and all the data for MainTable.SubTable is also loaded. If "Include" is not called, every returned MainTable'...
I have a simple config of haystack/solr on my django app:
from the models.py of this app:
class device(models.Model):
...
hostname = models.CharField(max_length=45, help_text="The hostname for this device")
...
from the search_sites.py of this app:
class devIndex(indexes.SearchIndex):
'''Haystack class to allow for i...
I am using Django, but I am not sure where to find the logs.
...
Is it possible to use threading when importing data from csv files to django.
...
Hi,
I want to use some fixtures in my tests.
I have cms_sample app and a fixtures folder inside with
cms_sample_data.xml
I use the following in my test.py:
class Funtionality(TestCase):
fixtures = ['cms_sample_data']
I do use TestCase of django.tests and not unittest.
But the fixtures are not loaded. What am I missing?
Th...
Having issues getting django custom commands to work.
From django documetation, have placed
application/
manage.py
blog/
__init__.py
models.py
management/
__init__.py
commands/
__init__.py
myapp_task.py
views.py
myapp_task.py content is
from django.core.management.base import NoArgsCom...
I'm using this code in one of my views:
if request.method == 'POST':
vehicle = VehicleForm(request.POST or None)
photos = PhotosFormSet(request.POST or None)
if vehicle.is_valid():
vehicle.save()
photos = PhotosFormSet(request.POST, instance=vehicle)
photos.save()
return HttpResponse...
Hello all,
I am a beginner in jquery so please bear with me.
I have a jquery function that allows me to select multiple checkboxes and create a string as follows:
function getSelectedVals(){
var tmp =[];
$("input[name='checks']").each(function() {
if ($(this).attr('checked'))
{
checked = ($(this).val());
...
How can I retrieve the last record in a certain queryset?
...
Can any one tell me how to use tagging auto-complete in django templates?
I have done this in django admin interface but i am confused to how to do it in the template.
Thanks in advance
...
Hi, I'm new to django and python...
I have a model which includes 10 generic fields attrib_00 through attrib_09.
I pass these fields as a context to a django template string.
I would like to use more meaningful names in the template.
The template strings are fetched from another model and I have in mind adding a field containing a co...