I need to run a lot of Django management commands in the crontab and want to log the output of each run to a special timestamped file. Is there a Django or Python module to help me do this or do I just have to roll my own?
...
Using django comments framework http://docs.djangoproject.com/en/dev/ref/contrib/comments/
Not sure is there option, to make all comments non private before they passed moderation...
Looks like all my comments are added to site, just after being posted. really need to change this
...
Hi folks,
is there any reason for me to place the session ID within a form,
as a hidden form field?
Thank you everyone!! :)
...
I have a django app with models as follows:
A Question model
An Answer model, with a ForeignKey
back to the Question. (A question can
have multiple answers.)
A Flag model, with a ForeignKey to
the Answer. (An answer can be flagged
as inappropriate.)
All of the above also have a user field, defining the user that created that object.
...
I want to create a decorator that will allow me to return a raw or "string" representation of a view if a GET parameter "raw" equals "1". The concept works, but I'm stuck on how to pass context to my renderer. Here's what I have so far:
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.te...
I expect this is an easy question. For some reason, I don't have a solution yet.
I have an object set from django reversion: version_list. Each object in the set has a user id attached to it. How do I grab the user names that correspond to the user ID's?
To try to be clearer, if each object in version_list has a name, date, and us...
I'm building a CMS for my company's website (I've looked at the existing Django solutions and want something that's much slimmer/simpler, and that handles our situation specifically.. Plus, I'd like to learn this stuff better). I'm having trouble wrapping my head around generic relations.
I have a Page model, a SoftwareModule model, an...
Understanding that I should probably just dig into the source to come up with a solution, I'm wondering if anyone has come up with a tactic for dealing with this.
In my project, I have a lot of images being generated outside of the application. I'm isolating them on the filesystem based on a model's pk.
For example, a model instance w...
Hi folks,
I am wondering if I could use simply use HTTP POST Requests in order to implement a SOAP API.
If so how should I format and treat the requests?
...
So I'm trying to use the django 1.1 template engine with the google app engine web app framework, from here. This is on Ubuntu Jaunty, I've made sure that the PYTHONPATH contains the location of Django-1.1.1 yet I'm getting this 'ImportError: No module named django' error when it tries to execute the use_library() line below. Again, coul...
Hi, I have the view function in django that written like a dispatcher calling other functions depending on the variable in request.GET, like this:
action = ''
for act in ('view1', 'view2', 'view3', 'view4', ... ):
if act in request.GET:
action = act
break
...
if action == '':
response = view0(requ...
Hello, having a similar model:
class Foo(models.Model):
slug = models.SlugField(unique=True)
img = ImageWithThumbnailsField(upload_to='uploads/',thumbnail={'size': (56, 34)})
It works fine but I want to add 2 more features to it:
1- It should also generate a second thumbnail sized 195x123, in addition to 56x34
2- While savin...
I am curious which one would be better fitting as a currency field ? I will do simple operations such as taking difference, the percentage between old and new prices. I plan to keep two digits after the zero (ie 10.50) and majority of the time if these digits are zero, I will be hiding these numbers and display it as "10"
ps: Currency i...
Hi. In my application I need to show in template stocks for my products. So from product view I'm returning variable {{stock}} which is my amount and then I'm trying to use it in template :
<div class="bar_in" width="{% widthratio {{stock}} 10 100 %}px" style="background:black;"></div>
But it constantly give me "Could not parse the re...
wrapper = FileWrapper(file("C:/pics.zip"))
content_type = mimetypes.guess_type(result.files)[0]
response = HttpResponse(wrapper, content_type=content_type)
response['Content-Length'] = os.path.getsize("C:/pics.zip")
response['Content-Disposition'] = "attachment; filename=pics.zip"
return re...
def download(source_url):
socket.setdefaulttimeout(10)
agents = ['Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)','Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1)','Microsoft Internet Explorer/4.0b1 (Windows 95)','Opera/8.00 (Windows NT 5.1; U; en)']
ree = urllib2.Request(source_url)
ree.add_header('User-Agent',ra...
Say I have a model object 'Person' defined, which has a field called 'Name'. And I have a list of people:
l = ['Bob','Dave','Jane']
I would like to return a list of all Person records where the first name is not in the list of names defined in l.
What is the most pythonic way of doing this?
EDIT: After thinking about it, what I real...
Hi, I'm kind of lost as to how to do this:
I have some chained select boxes, with one select box per view. Each choice should be saved so that a query is built up. At the end, the query should be run.
But how do you share state in django? I can pass from view to template, but not template to view and not view to view. Or I'm truly ...
Hi, all.
I'm writing a twitter-like note-taking web app.
In a page the latest 20 notes of the user will be listed,
and when the user scroll to the bottom of the browser window more items will be loaded and rendered.
The initial 20 notes are part of the generated html of my django template, but the other dynamically loaded items are i...
maps = (maps.filter(name__icontains=search_terms) |
maps.filter(description__icontains=search_terms))
i can't find this filter .
thanks
...