Given a model like so:
from google.appengine.ext import db
class X(db.Model):
p = db.StringProperty(verbose_name="Like π, but more modern.")
How does one access verbose_name from x=X() (an instance of X)?
One might expect that x.p.verbose_name would work, or alternatively x.properties()['p'].verbose_name, but neither seems to w...
I'm just learning django and following a tutorial. I have a Link and a Bookmark. Unlike the tutorial I'm following, I would like a link to be associated with only one Bookmark, but a Bookmark can have multiple links. Is this the way to setup the model?
class Link(models.Model):
url = models.URLField(unique=True)
bookmark = model...
I know that there is already a question (actually some more) about this, but the answers to them didn't help me out very much, as I am pretty new to lighttpd.
I have one folder which contains .pdf-files. When doing a HttpResponseRedirect to the locations of one of those .pdf-files, the user should be able to download the .pdf file (or v...
I am searching a django blog,then I find byteflow is good choice.
But I would like to run it on google app engine. I think I can try the app-engine-patch.
Is it possible to do that? any comment is appreciated.
...
Hi all,
I'm trying to build a test for a view that's decorated with
@login_required, since I failed to make it work, I did a simple test
and still can't make it pass.
Here is the code for the simple test and the view:
def test_login(self):
user = self._create_new_user()
self.assertTrue(user.is_active)
login = self.client.l...
Synopsis: Each User account has a UserProfile to hold extended info like phone numbers, addresses, etc. Then, a User account can have multiple Identities. There are multiple types of identities that hold different types of information. The structure would be like so:
User
|<-FK- UserProfile
|
|<-FK- IdentityType1
|<-FK- Identity...
I'm working on a Django site with a basic three column design. Left column navigation, center column content and right column URL specific content blocks.
My question is about the best method of controlling the URL specific content blocks in the right column.
I am thinking of something along the lines of the Flatpages app that will m...
In a Django application, I'm trying to access an existing MySQL database created with Hibernate (a Java ORM). I reverse engineered the model using:
$ manage.py inspectdb > models.py
This created a nice models file from the Database and many things were quite fine. But I can't find how to properly access boolean fields, which were mapp...
Running into a very stange error. I'm running Django on my Mac OSX and when I tried to send an email from my application it hangs and gives me this error: "Error 60, Operation Timed Out". Exception Location: ...python2.6/socket.py in create_connection
Any ideas?
...
We are using nginx-tornado-django to provide web services. That is, no web page frontend. The nginx server serves as a load-balancer. The server has 8 cores, so we launched 8 tornado-django processes on every server. Memcached is also deployed to gain better performance. The requests per day is about 1 million per server. We use MySQL as...
I configured properties for my django project under pydev. I can run the django app under pydev or under console window. But I have problems to run unittest under pydev. I cannot run unittest for app under console window either.
I guessed it's something related to run configurations of pydev, so I made several trials, but with no succe...
def upload_file(request, step_id):
def handle_uploaded_file (file):
current_step = Step.objects.get(pk=step_id)
current_project = Project.objects.get(pk=current_step.project.pk)
path = "%s/upload/file/%s/%s" % (settings.MEDIA_ROOT, current_project.project_no, current_step.name)
if not os.path.exists ...
When I run:
django-admin.py loaddata ../data/library_authors.json
the error is:
...
ValidationError: [u'Enter a valid date in YYYY-MM-DD format.']
The model:
class Writer(models.Model):
first = models.CharField(u'First Name', max_length=30)
other = models.CharField(u'Other Names', max_length=30, blank=True)
...
I have certain documents that I want to limit access to through Django to authorized users with permissions only.
If I'm going to use Django as a proxy to serve static files in a view, what are the implications? I'm used to serving static files in Apache and configuring that my media is served without any handlers, but what happens if s...
Hi,
I am using Django ORM in my python script in a decoupled fashion i.e. it's not running in context of a normal Django Project.
I am also using the multi processing module. And different process in turn are making queries.
The process ran successfully for an hr and exited with this message
"IOError: [Errno 32] Broken pipe"
Upon ...
google-app-engine-django/ claims to have an "App Engine compatible implementation of the Django authentication framework". Does this authentication work only with Google Accounts? Is it possible to register a user with a username/password and authenticate him/her with that username/password without that user having a Google account?
I...
Could you recommend a reporting solution for postgresql/django which is:
fairly flexible and easy-to use
can be deployed online
is free/opensource [optional]
output format is HTML/CSV(optional)
users can create new reports (via SQL)
if it can utilise underlying django's models that'd be great
...
I have a django project (django+apache+mod_wsgi+nginx) with multiple apps, I'd like to map each app as a subdomain:
project/
app1 (domain.com)
app2 (sub1.domain.com)
app3 (sub3.domain.com)
I have a single .wsgi script serving the project, which is stored in a folder /apache. Below is my vhost file. I'm using a single...
How can I test to see if a class contains a particular attribute?
In [14]: user = User.objects.get(pk=2)
In [18]: user.__dict__
Out[18]:
{'date_joined': datetime.datetime(2010, 3, 17, 15, 20, 45),
'email': u'[email protected]',
'first_name': u'',
'id': 2L,
'is_active': 1,
'is_staff': 0,
'is_superuser': 0,
'l...
Hi,
I'm using Django 1.0.2 and trying to figure out how to get the @login_required working correctly.
When I use the built-in server it redirects to the default login_url, or my LOGIN_URL as defined in settings.py as expected.
What is not clear to me is how to deploy to the server where my site is not at the root. In my templates I us...