Do webapp hosting sites such as webfaction.com support the use of cmd tools such as pdftk and pdftotext? For example, if in my django-powered site I do something like
subprocess.Popen("pdftk.exe....")
would this still work when I begin hosting the site?
...
I've got this model:
class Visit(models.Model):
timestamp = models.DateTimeField(editable=False)
ip_address = models.IPAddressField(editable=False)
If a user visits multiple times in one day, how can I filter for unique rows based on the ip field? (I want the unique visits for today)
today = datetime.datetime.today()
yesterd...
Is there a way to run Pinax without virtualenv?
I want to run it without virtualenv as I want to run it on a django-container on mediatemples grid-hosting service. Their containers can scale upto 1Gb of dedicated memory, so I wouldnt have to worry about my own VPS or scaling issues. But their response was:
" because of the way the Djan...
I have a simple Book Author relationship
class Author(models.Model):
first_name = models.CharField(max_length=125)
last_name = models.CharField(max_length=125)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
class Book(models.Model):
title = models.CharField(max_length...
I get:
TemplateSyntaxError at /blog/post/test
Caught NameError while rendering:
global name 'forms' is not defined
for this code:
forms.py
from dojango.forms import widgets
from django.contrib.comments.forms import CommentForm
from Website.Comments.models import PageComment
class PageCommentForm(CommentForm):
title = widg...
I want to add a column to a database table but I don't want to modify the 3rd party module in case I need/decide to upgrade the module in the future. Is there a way I can add this field within my code so that with new builds I don't have to add the field manually?
...
This is about the Format Localization feature that was implemented in Django 1.2.
In order to use this feature, you must add a localize=True parameter to all your form fields. I am trying to implement this localization in my app but the problem is that I am creating my forms dynamically by using the inlineformset_factory method that Dja...
Hello
I am trying to import from django.http import HttpResponse, but I am getting the following exception:
ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.
Could anyone help me please?
Thanks in advance
...
Hello I want to have a plaintext version of my content available. So I have a separate template for that. I am calling render_to_response with mimetype="text/plain" but i want to tell a browser opening that page in the http-response that the content is utf-8 encoded. How do i do that (e.g. what do i have to add to render_to_response)?
...
I'm working on a logging app in Django to record when models in other apps are created, changed, or deleted. All I really need to record is the user who did it, a timestamp, a type of action, and the item that was changed. The user, timestamp, and action type are all easy, but I'm not sure what a good way to store the affected item is be...
After installing django_message I noticed django has a nice little notification system build-in (Being: Auth_message). I was wondering how can I show them to users? They only appear in the admin panel as for now.
Which template tag can I use to integrate them into the site?
How can I add notifications?
...
I was wondering if using indexes on a model was possible:
class Buildings(models.Model):
island = models.ForeignKey(Island)
townhall = models.IntegerField(default=1)
lumberjack = models.IntegerField(default=0)
stonequarry = models.IntegerField(default=0)
ironmine = models.IntegerField(default=0)
[...]
a=Building...
I have a model class Project and for each model instance, there should be a 'group' of users who may edit that instance. I guess I could add another model class called ProjectEditor to add those editors. Is there a better way of implementing this? What about checking for permissions? I would need to write my own permission method then to...
Hello,
I am using django i18n and I have succeeded in translating strings and variables in my html tempate with {% trans "some string" %}.
But I want to translate a whole page content and not only a few strings, and my question: what is the best way to do this.
I have tried with {% blocktrans %} html content {% endblocktrans %}, but t...
My models:
class Entry(models.Model):
title = models.CharField(_('Title'), max_length=200)
content = models.TextField(_('Content'))
created_at = models.DateTimeField(auto_now_add=True)
My models is used for multi-user. So, how to set a value to handle minimum time between posts? Please give me some codes. Thanks so much!
...
Hi,
I work on manage.py command which creates about 200 threads to check remote hosts. My database setup allows me to use 120 connections, so I need to use some kind of pooling. I've tried using separated thread, like this
class Pool(Thread):
def __init__(self):
Thread.__init__(self)
self.semaphore = threadin...
i want to deploy my django project, what is best (on performance) of these 2 deployment methodologies:
Django-On-Twisted
apache mod_wsgi
i knew that mod_wsgi was recommended by django developers but i feel twisted is more efficient when running multiple django instance.
...
I just set up fastcgi with lighty for django, but I'm getting the fcgi file path when it processes the url, e.g. 404 error at http://myserver.myhost.com/myproject.fcgi. It needs to route to / instead of /myproject.fcgi.
Lighty conf:
$HTTP["host"] =~ "myproject\.myhost\.com" {
fastcgi.server = (
".fcgi" => (
...
I can see how to add an error message to a field when using forms, but what about model form?
This is my test model
class Author(models.Model):
first_name = models.CharField(max_length=125)
last_name = models.CharField(max_length=125)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_...
def cmd_run(host="localhost", port="8000"):
"""Run server at given host port (or localhost 8000)"""
from django.core import management
host_port = '%s:%s' % (host, port)
management.call_command('runserver', host_port)
I wrote a command like this. When I execute it. Exception was thrown:
Traceback (most recent call last...