I followed the instructions here to run Django using the built-in webserver and was able to successfully run it using "python manage.py runserver". If I access 127.0.0.1:port locally from the webserver, I get the Django page indicating it worked.
I realize the Django webserver is not a production server, but it's important for me for t...
I am trying to use a template that contains a link such as this:
<a href="{% url search query,page.previous_page_number %}">previous</a>
I am trying to use it in multiple contexts; in other words, the URL alias "search" needs to point to a different target, depending on the view that renders the template.
Is there a way to pass such ...
I made a management app imaginitively called update. The following work fine from the command line:
./manage.py update
/full/path/manage.py update
But when I have the following cron command:
00 */3 * * * /websites/bnc/manage.py update >/dev/null
It emails me this error:
Unknown command: 'update'
Type 'manage.py help' for u...
In my model i have a method like so:
class Content(models.Model):
#...
def get_file(self):
file = open('path/to/file','r')
return File(file)
I am attempting to access this method and the file object in my template like so:
{{ content.get_file.url }}
I am not getting any error but I am also not getting any ou...
I realize that templatetags are mainly used specific to applications which are INSTALLED_APPS, such as articles/templatetags/, but in my case I need tags for generic things such as navigation which doesn't have an application.
I'm currently keeping templatetags in my project dir. and in order for it to get picked up I added my project t...
I go to my webpage http://localhost:8000/listings/post/, it fails the test
@user_passes_test(lambda u: u.is_authenticated() and u.get_profile().shipper)
as expected, and redirects me to http://localhost:8000/login/?next=/listings/post/ like it's supposed to, but when I log in again, it doesn't redirect me back to that page like it's ...
I've got two systems that need to talk. The systems are setup likeso:
System A, running Django (Python 2.5) on Google App Engine (GAE)
System B, running Django (Python 2.6) on Ubuntu/Linux over Lighttpd (maybe nginx, later)
System A will periodically make requests ('requisitions') of System B using Url Fetch.
System B has a Django ap...
If we set up a profile how Django recommends:
class Profile(models.Model):
user = models.ForeignKey(User, unique=True)
Then when you delete the User object from Django admin, it deletes his profile too.This is because the profile has a foreign key to user and it wants to protect referential integrity. However, I want this function...
Let's say I have a django site, and a base template for all pages with a footer that I want to display a list of the top 5 products on my site. How would I go about sending that list to the base template to render? Does every view need to send that data to the render_to_response? Should I use a template_tag? How would you do it?
...
heya,
This is a fairly quick question regarding schema design for a Django project.
Basically, we have a series of monthly reports from different departments that are aggregated into a single report with some pretty charts (we're probably going to use Google Visualization API for that, but I'm open to other suggestions, if you think so...
The problem is the default User model does not have some very useful options given to the fields e.g unique=True to the email field.
I read this question: http://stackoverflow.com/questions/1817244/django-override-default-user-model-method, and checked Proxy Model concept, but with no effect.
At first I tried:
from django.contrib.auth...
Is there something akin to the 'Django Debug Toolbar' for ASP.NET (and more specifically ASP.NET MVC).
It's an HTML page overlay that shows total execution time, SQL queries (and time), what views were called... etc.
...
I have 3 AJAX functions to move data between a Django app on my website and some JavaScript using YUI in the browser. There is not a major difference between them in terms of their structure, concept, code, etc. 2 of them work fine, but in the 3rd one, I get one spurious HTTP request immediately after the intended request. Its POST data ...
thanks
the next is mysite1\django_openid\registration.py:
from django.http import HttpResponseRedirect
from django.core.mail import send_mail
from django.conf import settings
from django_openid.auth import AuthConsumer
from django_openid.utils import OpenID, int_to_hex, hex_to_int
from django_openid import signed
from django_openid ...
django code:
return render_to_response(template_name, {
"form": form,
}, context_instance=RequestContext(request))
and html:
<script type="text/javascript">
var a='{{form}}'
alert(a)
</script>
it's error is 'unterminated string literal',
and i see this in firebug :
<script type="text/javascript">
...
i used pinax,the user who login my site use openid is successful now ,
i only want to get the username and email when they return .
the google openid url is :https://www.google.com/accounts/o8/id
and yahoo openid url is :http://yahoo.com/
how can i get it .
thanks
...
if the key is https://www.google.com/accounts/o8/id?id=AItOawmqS0V2RR5FihojGdC90vXJpjcukoZ
how do i get the username who login my site ?
thanks
...
The question about covers it. I'm using dreamhost, and need to utilize the stdimagefield rather than image field so I can do this:
image3 = StdImageField(upload_to='path/to/img', size=(640, 480))
If there is a better way to do this, please let me know.
Edit: Trying it like this, everything is working with the "python manage.py shell...
I am writing a custom action for django admin. This action should only work for records having particular state.
For example "Approve Blog" custom action should approve user blog only when blog is not approved. And it must not appove rejected blogs.
One option is to filter non approved blogs and then approve them. But there are still...
Hi,
I'm working on a project in Python/Django which uses ReportLab's SimpleDocTemplate to generate PDF documents.
All the documents generated have the current date/time printed in the top right corner. I can't see that it's being done anywhere in my code, is this a default behaviour in the SimpleDocTemplate object?
How do I get rid o...