I am switching from using SQLite3 to PostgreSQL, and hoped that I could populate the database using the fixtures I had been using to populate SQLite3. However, I am getting these errors:
$ python manage.py loaddata fixtures/core.json fixtures/auth.json
Installing json fixture 'fixtures/core' from absolute path.
Problem installing fixtu...
We have a Django Model, ToolDataset, and a ModelForm, ToolForm. In the Model each instance, or database row, is referred to as a dataset, and the primary key is called the dataset_id. First time through, the user fills out an unbound form and submits it. Conceptually, this is the view code that is used to validate, save and analyze the d...
New to app engine and django. I think this is an issue with my django install, which is 1.1.1, but I've also read that I can just use the django packaged with the app engine SDK.
Any help on why I'm getting this error when I test locally would be greatly appreciated.
The callback:
Variable Value
callback
<class 'ourlat.main.views.Se...
Hey Everyone,
I want to schedule events to happen for my users. Is there an efficient way to do this in Python/Django easily? I'd prefer not to poll a priority queue.
Thanks!
Edit: I want to clarify that this job is run per user, for potentially hundreds or thousands of users.
...
Hi,
I m having a porblem.I m exporting data to an excel in my django admin.The functionality is fine until some special characters are not there.
I have a text " ACTPrinter ★ Print to iPhone " when i try to export this to an csv file ,
it gives an error
UnicodeEncodeError at /admin/core/wappubfilter/
'ascii' codec can't encode ...
In the below code:
var id=obj.setid({{info}});
I get an error saying illegal character and {{info}} has the following string:
"Website® is registered "
How do I handle this error in javascript?
Thanks..
Edit:
setid looks like this
setid: function (id)
{
var obj = $(this) ;
...
I have a field for addedBy in one of my classes. I've set up a count for this field as below:
user_count = Issues.objects.values('addedBy').annotate(count=Count('id'))
Then in my template I'm accessing the variable as
{% if user_count %}
<div class="menutitle"><strong>{% trans "Added By" %}</strong></div>
{% for item in us...
I want to add a custom model method to the admin filter, however it fails.
Example Foo:
class Foo(models.Model):
number = models.IntegerField()
def big_enough(self):
return self.number > 99
now at the admin panel:
class FooAdmin(admin.ModelAdmin):
list_filter = ('number', 'big_enough')
Fails, I get the error...
I want to add a filter in an admin changelist by a property of a foreign key, e.g.
class Address(model.Models):
street = models.CharField(max_length=25)
city = models.CharField(max_length=25)
country = models.CharField(max_length=25)
class Customer(models.Model):
name = models.CharField(max_length=25)
...
Model1 has a ForeignKey to Model2. And Model2 has a ForeignKey(Model3, null=True, blank=True) to Model3. By default, when I use select_related() on Model1, Model3 is not selected because of null=True. How can I force select_related() to follow a foreign_key that has has null=True?
The only way I can think of is to explicitly select thes...
Hi
I need to build a django project on top of an existing database.
I'll use inspectdb as explained in the django docs and then syncdb to create the django required tables.
Is there a way to keep track of the django specific tables (admin permissions, content types...)?
I want to be able to remove django completely in the future if nee...
The Django documentation on tests states:
For a given Django application, the test runner looks for doctests in two places:
The models.py file. You can define module-level doctests and/or a doctest for individual models. It's common practice to put application-level doctests in the module docstring and model-level doctests in...
I'm using the Django ORM in a non-Django application and would like to turn on the DEBUG setting so that I can periodically log my queries. So I have something vaguely like this:
from django.db import connection
def thread_main_loop():
while keep_going:
connection.queries[:] = []
do_something()
some_logging...
Hi there
I'm trying to work out how to run a process in a background thread in Django. I'm new to both Django and threads, so please bear with me if I'm using the terminology wrong.
Here's the code I have. Basically I'd like start_processing to begin as soon as the success function is triggered. However start_processing is the kind of ...
Hi,
What is the pythonic way of writing a unittest to see if a module is properly installed? By properly installed I mean, it does not raise an ImportError: No module named foo.
...
How can you get the SQL for a Django model's .save(), i.e.
from django.db import models
class MyM(models.Model):
text = models.TextField()
How can you get the SQL that would be created/used in the following scenario:
>>> m = MyM(text="123")
>>> m.save()
# What SQL Django just run?
Thanks!
...
If you've got a database setup in Django, how can you have the TestRunner use the 'live' database (per the DATABASE_* settings in settings.py) instead of running them on the ephemeral test database.
For example, I'd like to run the following test on the live database that's specified in settings.py:
import unittest
from example import...
I'm using Rails 3 Beta and I assume the syntax is similar to the 2.x. I'm also not very familiar with Ruby and Rails.
In Django, multiple foreign keys to the same model looks like the following:
class Dish(models.Model):
name = models.CharField(max_length=100)
lunch = models.ForeignKey(Ingredient, related_name='lunch')
din...
Let's say I have some classes:
class Resource(models.Model):
files = models.ManyToManyField("File")
class File(models.Model):
name = models.CharField(max_length=255)
file = models.FileField(upload_to="path/here")
In the Admin View, instead displaying the select multiple box, I want to display something like this:
Name of ...
I'm using jQuery's .ajax() to call a server (actually local Django runserver) and get a response.
On the server console, I can see that the JSON request comes in, he proper JSON response is made, and everything looks OK.
But in my browser (tested on Firefox 3.6 and Safari 4.0.4, and I'm using jQuery 1.4.2), it seems the response body i...