django

Django Models (1054, "Unknown column in 'field list'")

No idea why this error is popping up. Here are the models I created - from django.db import models from django.contrib.auth.models import User class Shows(models.Model): showid= models.CharField(max_length=10, unique=True, db_index=True) name = models.CharField(max_length=256, db_index=True) aka = models.CharField(max_le...

Django: How to send HTML emails with embedded images

Hi all. How can I send HTML emails with embedded images? How the HTML should link to the images? The images should be added as MultiPart email attach? Any example is very appreciated. ...

Post create instance code call in django models

Hi folks, Sorry for some crazy subj. I'd like to override django models save method and call some additional code if the model instance is newly created. Sure I can use signals or check if the model have empty pk field and if yes, create temporary variable and later call a code: Class EmailModel(models.Model): email = models.Emai...

Outputting escaped characters in django templates

I want to use the django templating system to output csv like data which looks like; !connection%block !dosomething !dosomethingelse My,Header,Row,Which,Is,Comma,Seperated All,My,Comma,Seperated,Data All,My,Comma,Seperated,Data All,My,Comma,Seperated,Data All,My,Comma,Seperated,Data !Footerblock !that has footer information The actual...

Django 3rd Party Auth Systems

Hi all, I am considering a 3rd part Authentication system for logging in (new/old) users. Much like how StackOverflow authenticates it's users. This scheme is good as it frees me from doing authentication from my side. I need this - Login using Google, Facebook, Twitter, Yahoo, OpenID Authentication Systems. Provide the same user logge...

Django: Login form in template tag

I've made a template tag to display a login form on various pages of my site. The idea behind that is also, that after logging in you see the same page/content as before and you don't get redirected to another page. I could do form validation & logging-in without any problems in the template-tag's render method, but the problem is, that...

django on nginx & apache : where to handle 404 & 500 error ?

I know there is 404 error handling in django. But is it better to just put that config in nginx ? This ST thread has the solution for putting it. - http://stackoverflow.com/questions/1024199/nginx-customizing-404-page Is that how everyone handles it when using nginx ? I have created my own 404.html & 500.html in the sites theme, want ...

Django query on history

Hi there, I have a model "Item", which has a 1:n to "Location". Means, there is a location-history for items. Location has a FK to "Room", "Room" to "Floor" and "Floor" to "Building". Now, I want to select all Items which are currently located an a specific Floor. I could solve it with a list comprehension, but is there any nicer way ...

Django generic foreign key and select_related

Hello guys, I'm trying to do select a model using a relation with a generic foreign key, but it's not working as expected. I think it's better illustrated and understandable with code class ModelA(models.Model): created = models.DateTimeField(auto_now_add=True) class ModelB(models.Model): instanceA = models.ForeignKey(ModelA) cont...

Calling a Django URL from JavaScript

Hi all... *EDITED THIS QUESTION FOR CLARITY* I have a Django template with a flash object in it. The template itself inherits from the main template and is in a block called info. Everything works ok with that! When the flash object is clicked it calls a JavaScript callback function, with a parameter, in a separate js file. Within thi...

Google App Engine does not accept cleared values for db.IntegerProperty from my django forms

I have a very simple db.Model that contains a db.IntegerProperty and a db.TextProperty: class Foo(db.Model): shoe_size = db.IntegerProperty() comments = db.TextProperty() From this I created a very simple Django Form Object: class FooForm(djangoforms.ModelForm): shoe_size = forms.IntegerField(required=False) comments ...

Mako templates using Django template tags

Our Django site is built using Mako templates. We want to use a third party project called django-socialregistration, but its template tags use Django's templates. If we used Django templates we could just {% load facebook_tags %} {% facebook_button %} {% facebook_js %} How can I do the same thing in Mako? You can inline strait up py...

Can django-comments handle multiple comment forms on the page?

I have multiple models on a Django-powered webpage that have a django.contrib.comments form rendered for each. On this page, a post from one of these forms to /comments/post/ always results in: Forbidden (403) CSRF verification failed. Request aborted. If I include the same comment form code on another page where there is just one su...

How to receive jQuery.get() in django view

I have a very simple test with jQuery and a django view: HTML - Includes jQuery.js JavaScript - $(document).ready( $.get("/index/" ); ) Django urls.py: (r'^index/', index_view ), Django views.py: def index_view(request): if request.GET: return HttpResponse( "RECEIVED GET" ) Debugging in browser, the javascript gets called ...

PDF in response to POST - android browsers perform additional GET and save that as file

My Django view generates a PDF via pycairo in response to a POST (I'm not redirecting in response to the POST). When I POST using desktop browsers I can save and/or view the PDF using Adobe Reader or Document Viewer. However, when I POST via my android browsers the Adobe PDF Reader and the ThinkFree viewers both report the file as corrup...

Using a generator to stream JSON data in real time from subprocess in Django with JQuery

I want to read in real time the output of a subprocess called from a form in a view. Here is my views.py: @login_required @condition(etag_func=None) def sync_form(request): # do things to validate form return HttpResponse(sync_job(request, job_id, src, dest)) def sync_job(request, job_id, src, dest): # we check the argument...

django-paypal setup for paypal web site pro (wpp) signal issues

I'm using dcramer's fork of django-paypal and I've been successful in setting it up until now. I tried to connect 'paypal.pro.signals.payment_was_successful' to a listener I wrote but it sends the signal multiple times which is causing errors in my application. I've tried adding the 'dispatch_uid' to my connect statement but it still sen...

Configuring django south with PostgreSQL

I can't get my site running with south. I've successfully installed south, and I can 'import south' successfully. ./manage.py shell >>> import south >>> However, once I add 'south' to INSTALLED_APPS, and run ./manage.py syncdb (to complete the installation), I get the following error: There is no South database module 'south.db.d...

Problem with locating template

I'm trying to install django lfc on my server. Apart of zilions of different problems I've encountered now I'm struggling with TemplateDoesNotExist. In my settings file I have set TEMPLATE_DIRS variable like this : TEMPLATE_DIRS = ( "/home/snow4life/lfc/templates", "/home/snow4life/lfc_theme/templates" ...

Managing subdomains

What are the best practices and solutions for managing dynamic subdomains in different technologies and frameworks? I am searching for something to implement in my Django project but those solutions that I saw, don't work. I also tried to use Apache rewrite mod to send requests from subdomain.domain.com to domain.com/subdomain but couldn...