Hi there,
I'm running a Django app for my root public_html folder, and it's working fine. But there's a problem with one of my other apps. The problematic app is accessed through a redirect to a subdirectory (e.g. http://workingsite.com redirects to public_html, http://brokensite.com redirects to public_html/foo)
The problem is that th...
Hello everyone.
I have this code that works. My class is a db.Model one2many with a teacher, experience, and so on...
What I want is to call the class teacher with forms, but also intend to include other classes, like a form from experience class and a form from category.
These classes are as foreign Key teacher.
I wonder how to derive...
I need to add analytics feature to our web service so we can provide our customers a way to understand their own content. I was wondering if anybody can provide some pointers, guidelines on designing such solutions. I know this is a little too open-end. Here is a list of concrete questions, and I have a vague idea on some of them but I w...
I can't figure this out.
Here's what I want to happen ...
I have an applications that users upload files to S3 using boto and django. I want those files to be private and only accessible through my app using my api credentials.
So if a user uploads a photo via my app, the only way he or anyone else can download it is via his accoun...
I have an app called lastapp that I would like it to be viewable on all pages. It renders base.html so it's available on all apps. So far I've tried adding it to the urls.py like this:
urlpatterns = patterns('',
(r'^first/$', firstapp, lastapp),
(r'^last/$', lastapp),
)
But when I go to /first/ it gives me the error: Error,...
I notice that the official recommended book "The Definitive Guide to Django" was written based on mod_python, for both editions.
However, I think most beginners would follow what most people use: mod_wsgi.
I followed their first tutorials, that is, display current time
I have the mod_wsgi and everything setup correctly. But I am still...
blow is my database:
class TestCases(TmstafServerModel):
name = models.CharField(max_length=30)
class TestRunSummary(TmstafServerModel):
testResult = models.ForeignKey(TestResult)
testCases = models.ForeignKey(TestCases)
platform = models.ForeignKey(Platform)
I want to get data order by testcase's name, such as:
all_...
how to populate user when we add objects and save them in django_admin site. the problem occurs when i click save button.And it shows an error like, user_id may not be null... what should i do???
thanks
...
In my application, I want to create entries in certain tables when a new user signs up. For instance, I want to create a userprofile which will then reference their company and some other records for them. I implemented this with a post_save signal:
def callback_create_profile(sender, **kwargs):
# check if we are creating a new User...
If there were field.errors in django, how to to add css class to {{ field }}, example at bottom
{% for field in form %}
{{ field }}
{% if field.errors %}{{ field.errors }}{% endif %}
{% endfor %}
Aiming for {{ field }} input type that would have "class=error" when ever there was an error
<input class="error">
...
The Django book says: "The core Django framework works with any Python version from 2.3 to 2.6, inclusive. Django’s optional GIS (Geographic Information Systems) support requires Python 2.4 to 2.6."
...
I'm having trouble installing Django, even if I follow the instructions here: http://www.djangobook.com/en/2.0/chapter02/
Could someone please provide baby steps to installing Django. I'm talking baby steps that really break it down, so that a retarded person could do it.
I've installed Django and unzipped the file, but I'm unsure wher...
It seems I cant make this example print "You submitted nothing!".
Everytime I submit an empty form it says:
You submitted: u''
instead of:
You submitted nothing!
Where did I go wrong?
views.py
def search(request):
if 'q' in request.GET:
message = 'You submitted: %r' % request.GET['q']
else:
message = 'You su...
I have a many to many relationship model which actually shows as a multi select list on forms. In one particular place I want to show it as dropdown single selection - any idea how to do this?
...
I was trying to assign a file from my disk to the FileField, but I have this error:
AttributeError: 'str' object has no attribute 'open'
My python code:
pdfImage = FileSaver()
pdfImage.myfile.save('new', open('mytest.pdf').read())
and my models.py
class FileSaver(models.Model):
myfile = models.FileField(upload_to="files/")
...
A while ago I created a frontend for a database using RoR and ActiveScaffold. ActiveScaffold let me easily create lots of the features I needed: Read Only Access, Sexy Interface, Sorting, Advanced Search, Pagination etc. I would now like to do the same thing in Django. Is there any equivalent to ActiveScaffold for Django? Do I need to u...
Possible Duplicate:
How to assign a local file to the FileField in Django?
I was trying to assign a file from my disk to the FileField, but I have this error:
AttributeError: 'file' object has no attribute 'open'
My python code:
pdfImage = FileSaver()
myPdfFile = open('mytest.pdf')
pdfImage.myfile.save('new', myPdfFile)
a...
In James Bennett's "Practical django Projects" (2nd edition) the author builds a content management system, leveraging off of django.contrib.admin. The problem is that it doesn't work.
I'm in chapter three, where he adds a keyword search capability, by adding a new admin module. The problem is is that I can't get it to work. Browsing...
Translation works, switching between languages also. But every few page refreshes, some parts of page are in different language than the rest.
I replaced ugettext with ugettext_lazy which helped but still there are places where this is occurring. Anyone seen something like this?
...
How can I check from within a Django template whether a given date is in the future?
Something like:
{% if event.date > now %}
...