I'm writing a django login view, that re-uses the generic one to do most of its heavy lifting, but I handle some details afterwards:
COMPANY_COOKIE = 'last_login_company_id'
def login(request, *args, **kwargs):
initial_company_id = request.COOKIES[COMPANY_COOKIE] if COMPANY_COOKIE in request.COOKIES else None
def makeCompanyAut...
Hi all,
I'm running a web crawler that gets called as a separate thread via Django. When it tries to store the scraped information I get this error:
File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 147, in execute
charset = db.character_set_name()
InterfaceError: (0, '')
If I manually run the script from the command li...
I am reading the definitive guide to django and am in Chapter 4 on template inheritance. It seems that I am not doing something as elegant as should be possible as I am having to duplicate some code for the context to appear when calling the child view. Here is the code in views.py:
def homepage(request):
current_date = datetime.da...
I'm trying to take an UploadedFile, convert it to a PIL Image object to thumbnail it, and the convert the PIL Image object that my thumbnailer returns back into a File object. How the heck can I do this?
...
I'm trying to mimic the admin interface for the Photologue app on the front end. To achieve this, I have thus far created a bit of code in the view:
def galleryuploader(request):
GalleryFormSet = modelformset_factory(GalleryUpload)
if request.method == 'POST':
formset = GalleryFormSet(request.POST, request.FILES)
...
I have dajaxice installed on my python2.6 dist-packages folder, that seems to work alright with importing the stuff. But it throws all kinds of errors, since the django template tags are not being rendered.
invalid property id [Break on this
error] {% for module in
dajaxice_js_functions %}\n
Makes sense, so I tried putting the ...
I'd like to implement a functionality in an app of mine, but I don't know how to go about it. What I want is this: I have a model class that uses imagekit to save its images, and I'd like to have the users being able to update the images easily for the vehicles without having to edit each respective vehicle record.
How they'll do thi...
I’ve written a custom template tag:
def mytag(para):
return something
In my template I am getting a value {{value}}. Now I am using {{value|mytag}} to apply the tag to the value, and it is throwing a syntax error.
...
I'm making a weblog site in Django. I have a Blog model like this:
class Blog(models.Model):
name = models.CharField(max_length=255)
slug = models.SlugField(max_length=255)
...
And I want the front pages of each blog to be at URLs like this: www.example.com/blog-slug/
However, I'm also using Flatpages and will want that t...
Version info:
Django version 1.3 pre-alpha SVN-13858
Ubuntu GNU/Linux 10.10
I'm totally new to i18n and l10n in Django and currently I'm trying to make my Django project available in Dutch (in addition to its default language: English). I tried to apply the instructions given at http://docs.djangoproject.com/en/dev/howto/i18n/ and ht...
When developing a Django application, what is sys.path supposed to contain? The directory which contains the project, or the directory of the project, or both?
...
When I send a POST message to the GAE with a json parameters using POST the QueryDict parsed by the server is not parsed like a json ...
I found a similar problem in this issue: http://stackoverflow.com/questions/2579235/iphone-json-post-request-to-django-server-creates-querydict-within-querydict
Maybe is a problem with the GAE configu...
Hi,
I have a problem.
I Have urls like that :
/articles/rating/month/
/articles/viewing/day/
...
So for these urls, I have a function view_articles() with parameters : sorting,*order*.
Everything works fine.
But,now I think it would be great if, when I visit one of these urls, I go in a function articles() which returns all the a...
Like, have them logged to the console?
...
I am using mysql database. I have many schemas with many tables. I want to create a Django admin interface for various tables in different schemas. Currently for a single schema I am using a setting like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'schema1',
...
I am trying to make a change at the auth.models.py file to force the password hashing function (get_hexdigest()) to not use the salt when passing the sha1. So the change would be:
auth.models.py line 33
before:
return sha_constructor(salt+raw_password)
after:
return sha_constructor(raw_password)
However, when I make the chang...
Hi folks,
any tips on testing email sending? Other than maybe creating a gmail account, especially for receiving those emails?
I would like to maybe store the emails locally, within a folder as they are sent.
Tips would be great! Thanks :)
...
In my django app, I would like to be able to add customized help text to the admin change form for some of my models. Note I'm not talking about the field specific help_text attribute that I can set on individual fields. For example, at the top of the change form for My_Model in My_App I'd like to be able to add some HTML that says "Fo...
Hi guys, i have a "rare" behavior here, i this model:
models.py
class Area(models.Model):
area = models.CharField(max_length=150,unique=True)
slug = models.SlugField(max_length=200)
fecha = models.DateTimeField(default=datetime.date.today,editable=False)
activa = models.BooleanField(default=True)
class Empresa(models.M...
I'm trying to use a property in my model as a field in django admin (1.2).
Here's an example of my code:
class Case(models.Model):
reference = models.CharField(_(u'Reference'), max_length=70)
client_read = models.BooleanField(default=0)
def __unicode__(self):
return self.case_id
@property
def case_id(self)...