I seem to be getting an IOError: request data read error quite a lot when i'm doing an Ajax upload. For example out of every 5 file uploads it errors out on atleast 3.
Other people seem to have had the same issue. Eg.
http://stackoverflow.com/questions/2641665/django-upload-failing-on-request-data-read-error
http://stackoverflow.com...
In my django admin section, I'd like to show different versions of the admin page depending on what kind of user is currently logged in. I can think of a couple ways this might work, but haven't figured out how to do any of them.
Perhaps I could put logic into the admin.ModelAdmin to look at the current user and change the 'exclude' fi...
I'm trying to use Django's annotate feature to add the count of a related model to a queryset. However, I don't want a full count of related objects, I only want to count the active ones (i.e., "is_active=True"). I can't figure out how to filter down the count.
The (simplified) relevant models:
class Post(models.Model):
user = mode...
I have a Django model class with a non-model-field property, ex:
def _get(self):
return "something"
description = property(_get)
I'm using the model class with in a ModelForm / ModelFormset. Is there any way to access the property from the form / formset? If not, what's best practice for including extra "display" data in a djang...
I've tried 3 different approaches, and nothing seems to work. Here's my view:
def my_view(request):
if request.method == 'POST':
form = DealershipForm(request.POST)
if form.is_valid():
dealership = form.save(commit=False)
dealership.entered_by = User(id=2)
dealership.save()
...
Hello,
I have the following code that I need help encoding to JSON and appending the data to a file, foo.json
Here is my code:
user = request.user
print 'USER ID ', user.id // 83
sour = json.dumps({"toast" : [{"uid" : user.id }]})
print 'Sour Toast: ', sour.toast # I'm getting this error: AttributeError: 'str' object has no attribute ...
I would like to integrate an existing application someone has on github into my site. What steps do I need to take to integrate it?
Would most people just download this entire thing and throw it inside of the project root, add it to the INSTALLED_APPS and modify urls.py? I would imagine there are some extra steps I'd have to take to get...
Hi, i'm working on on a project with DJango but i'm also thinking about going the Jython route. By doing so...since i'll be using the java instance instead of cpython wouldn't I be able to use java, scala, ruby and other other languages that run on top of the jvm if need be?
...
M2Crypto raises a TypeError when loading SSL CA certificates. I'm getting the path of an SSL certificate from an instance of a Django model. My code worked perfectly because I was pulling the path of the certificate from a Django model
My code:
from M2Crypto import SSL
from django.db import models
class MyModel(models.Model):
...
I need a regexfield in a django form to only accept letters and numbers, and nothing else. I've tried this, but it didn't work:
myfield = forms.RegexField(label=("My Label"), max_length=31, regex=r'[a-zA-Z0-9]',
error_message = ("This value must contain only letters and numbers."),
I am not very good at using regular expressi...
I've got two applications (app1 and app2) in my django project.
I'm curious if there is a way to import things between applications.
baseProject
--app1
----models.py
----etc..
--app2
----models.py
----etc..
I'd like to be able, while in app2, to import something from the models section of app1. Is there an intended method to do ...
I am using celery for distributed task processing. I wanted to deploy my work on a web-host, just to show the working of my project.
So how can i get djcelery to use a database (sqlalchemy) as backend with django instead of rabbitmq or other ampq servers.
...
I found a lot of options but this one https://launchpad.net/django-openid-auth
looks good. sadly I can't find examples/HOWTO about this?Does anyone point/redirect me to correct urls?
...
Hi All,
Is there a way to implement the permissions for models through the code? I have a large set of models and I want some of the models to be just viewable by the admin and not the ability to add them.
Please suggest.
...
Hi there,
I'm using django-treemenus
I'm curious to see if there is a better way to write out my menu.html which is my menu template. For each level that I add to my menu I have to manually add a level to my menu template.
Here is my menu.html (menu template). It works, but could it be written more efficiently?
{% load tree_menu_tags...
I need to write model data (CharFields only) to an XML file to contain the data for a flash file. I am new to this, and the process is a little unclear to me for doing this in django. I am creating an xml file, and then writing the text data to the file (as is done with the csv module, but to xml). A very simplified xml file should re...
Hi everyone,
is it possible to read personal digital certificates with extension Pcks#7 ( http://en.wikipedia.org/wiki/X.509#Certificate_filename_extensions ) with python?
I have to develop an application using Django that authenticate its users by reading their certificate.
In an initial step we are going to use an external services t...
I’ve got a Django template that’s receiving a list of objects in the context variable browsers.
I want to select the first object in the list, and access one of its attributes, like this:
<a class="{{ browsers|first.classified_name }}" href="">{{ browsers|first }}</a>
However, I get a syntax error related to the attribute selection ....
I'm writing unit tests in Python for the first time, for a Django app. I've struck a problem. In order to test a particular piece of functionality, I need to change the value of one of the app's settings. Here's my first attempt:
def test_in_list(self):
mango.settings.META_LISTS = ('tags',)
tags = Document(filepath).meta['tags']...
I am trying to use Python (through Django framework) to make a Linux command line call and have tried both os.system and os.open but for both of these it seems that the Python script hangs after making the command line call as the call is for instantiating a server (so it never "finishes" as its meant to be long-running). I know for doin...