Hi,
In my development system (mac os x) I added the following lines at the end of my urls.py file:
if re.match('darwin',sys.platform):
# serving media files using the development server
urlpatterns += patterns('',(r'^site_media/(?P<path>.*)$',
'django.views.static.serve',
{'document_root': '/Users/henri/sites_django...
Currently I'm using an old and patched version of sorl.thumbnail, which kind of works, but I'm afraid of touching it any further. I'm looking around for a proven, working with django 1.2, south-compatible, sorl.thumbnail-like-configurable (ie. multiple thumbnails for a single image) ImageWithThumbnailsField. Any recommendations?
edit: b...
I have a Django admin action called "Email selected members". Check some members and click the Go button and the user's mail program is opened. The emails of the selected members have been pre-entered.
This works by a Django HttpResponseRedirect(uri) with the uri being "mailto:email1,email2..
where the addresses email1, email2 ... were...
So far, I have:
I recompiled my nginx package with uwsgi ( 0.7.67 )
Copied over my uwsgi to sbin via sudo cp uwsgi /usr/local/sbin
Copied uwsgi params via sudo cp nginx/uwsgi_params /etc/nginx
$ sudo mkdir -p /usr/local/nginx/uwsgi_temp
Created a virtualhost in sites-available and symlinked in sites-available. File is:
server {
...
I want to programatically modify the widget attributes of a field in a Django ModelForm's init() method. Thus far, I've tried the following
def __init__(self, *args, **kwargs):
super(MyForm, self).__init__(*args, **kwargs)
self.fields['my_checkbox'].widget_attrs(forms.CheckboxInput(attrs={'onclick':'return false;'}))
Unfortun...
I was looking at the INSTALLED_APPS of django-mingus:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.sitemaps',
'django.contrib.flatpages',
'django.contrib.redirects',
'django_extensions',
'tagging',
...
What is the best way to manage GPS coordinates (latitude and longitude) in django models ?
I know that there is a module called GeoDjango but reading the tutorial seems dedicated to GIS and not simply to manage the latitude and longitude.
I do not care to have convenient interface for the admin because int the application I'm creatin th...
Possible Duplicate:
Django notification on comment submission
How can I specify which users get notified about new comments using Django's comment and moderation framework? In the documentation it says that the site staff will get an email notification, but when I'm posting a new comment only the very first user (the one that ...
Hi, I am looking to make a query that selects between dates with Django. I know how to do this with raw sql pretty easily but using the Django ORM, how could this be achieved.
basically,
start_date = datetime.datetime.now() + datetime.timedelta(-30)
context[self.varname] = self.model._default_manager.filter(
current_issue__isnull=T...
On my django site, I decided to just use the admin templates for the UI, but I made a few tweaks like the site name, color, etc. even my custom views just extend admin/base_site.html I did this by creating templates/admin/base_site.html with the following code:
{% extends "admin/base.html" %}
{% load i18n %}
{% block title %}{{ title }...
I'm trying to bulk delete all of the comments on a dev instance of my Django website and Django is raising an AttributeException.
I've got the following code on a python prompt:
>>> from django.contrib.comments.models import Comment
>>> Comment.objects.all().delete()
Traceback (most recent call last):
File "<console>", line 1, in <mo...
I'm going to start looking into this tomorrow when I begin my project, but could anyone point me in the right direction? (Maybe some integration code and/or a sample Pyjamas interface which uses Pinax as the backend -- all with adequate explanation, if possible? :)
Thanks!
...
Hey guys.
I have a model that references a ForeignKey(User) field.
When a user selects an item on his form I would like them to be able to see the get_full_name() instead of just the username.
class Books(models.Model):
author = models.ForeignKey(User)
...
Hi !
I am currently writing an API for a django project, and using django-piston for this. However, I need to customize the way certain base types are serialized.
More precisely, my models are subclassed from a special Model class, which inherits from django.db.models.base.ModelBase, but cannot be serialized as regular django models .....
In my django application I have different content across the site. Now I would like to add "Share this to... (Facebook,Twitter,Buzz)" link on each page. But instead of redirecting to a social app page I would like to open popup with (if needed) logging/adding possibility. How to get started ? What steps/operations I need to perform and w...
When reading source code of Django, I find some statements:
class Field(object):
"""Base class for all field types"""
__metaclass__ = LegacyConnection
# Generic field type description, usually overriden by subclasses
def _description(self):
return _(u'Field of type: %(field_type)s') % {
'fiel...
Hey, this is a quick one. I have two models, Post and Term and I'd like to be able to tag and categorize (taxonomy) posts as well as other (future) models. My Post model has the following fields: title, content, published (date) and my Term is declared like this:
class Term(models.Model):
taxonomy = models.CharField(max_length=255)
...
Even though a field is marked as 'editable=False' in the model, I would like the admin page to display it. Currently it hides the field altogether.. How can this be achieved ?
...
If you want to override a template coming with an app in django (in app/templates/app/) you create a template of the same name in another directory, which the template loader checks before the app's template dir. If you just want to override certain blocks of the template you also have to copy the whole template ad change that block, whi...
Let say I have a django ModelForm which I want to edit before saving.
For example,
Instead of this
model_instance = form.save()
I would like to do something like this
model_instance = form.get_model()
model_instance.edit() #say add a new field which is not available on form
model_instance.save()
...