django

JQuery Ajax function called twice with same data

I'm building a very simple page that is a to-do list. It accepts input from a user via a form for new to-dos, POSTs the to-do to the server, then receives (almost) the same data back and adds it to a list. However, every time data is supposed to be sent to the server, the $.ajax function is called twice. My js: // todo.js function onlo...

Django and Python + uWSGI

Using instruction I try to connect Python + uWSGI. I made default project in a folder /home/sanya/django/pasteurl. However, have opened it in a browser I get uWSGI Error wsgi application not found Logs contain the following: binding on TCP port: 9001 your server socket listen backlog is limited to 64 connections added /home/sanya/dj...

Django -- CSRF Failure on IE for IFrame. No access to parent server headers for Policy Fix

I have a problem with CSRF validation failing on iframes in IE. I've learned I can fix it if i had access to parent page server by adding certain headers to my headers according to post http://stackoverflow.com/questions/389456/cookie-blocked-not-saved-in-iframe-in-internet-explorer, but I have no access to the parent page (third party...

Django friends setup questions

Hi. I am trying to use django-friends in my app, with no luck. This app is not well documented and I cannot seem to find any real information about it out there. Has anyone used this app in their project before? Something that is not a PINAX project. Any links or ideas will be appreciated. ...

Can Django use "external" python scripts linked to other libraries (NumPy, RPy2...)

Dear all, I am new to the world of IT business (serious) development but I have in mind a business idea and still trying to vizualize how the overall infrastructure should work. I have done some few research for a good technology to deliver the solution. I am very inclined to use Python, MySql, Django (Apache) on the server side and so...

Is there a clever way of integrating POST/GET ajax calls into the Django Admin?

I am considering doing this via a REST API, since I might be needing it further on in the project. But perhaps there's a better way of doing this? ...

Refresh div using JQuery in Django while using the template system

I want to refresh a in django that contains temperature data. The data is fetched every 20 seconds. So far I have achieved this using these functions: function refresh() { $.ajax({ url: '{% url monitor-test %}', success: function(data) { $('#test').html(data); } }); }; $(function(){ refresh(); var int = setInterval("ref...

How to get IP when using SimpleXMLRPCDispatcher in Django

Having a code inspired from http://code.djangoproject.com/wiki/XML-RPC : from SimpleXMLRPCServer import SimpleXMLRPCDispatcher from django.http import HttpResponse dispatcher = SimpleXMLRPCDispatcher(allow_none=False, encoding=None) # Python 2.5 def rpc_handler(request): """ the actual handler: if you setup your urls.py pr...

Best way to create Singleton Table in Django/MySQL

I want a table which can only have one record. My current solution is: class HitchingPost(models.Model): SINGLETON_CHOICES = (('S', 'Singleton'),) singleton = models.CharField(max_length=1, choices=SINGLETON_CHOICES, unique=True, null=False, default='S'); value = models.IntegerField() def __unicode__(self): ret...

Apache mod_wsgi Django setup - Forbidden You don't have permission to access /mysite on this server

I have install python 26, Apache 2.2, modwsgi ap2.2 py26 On windows XP. and apache loads modwsgi fine. when I check localhost: apache says - It works! but when i try to open the Django directory mysite: localhost/mysite i get : Forbidden You don't have permission to access /mysite on this server. I have re-installed and installed this ma...

Django Form validation including the use of session data

The use case I am try to address is a requirement for a user to have downloaded a file before being permitted to proceed to the next stage in a form process. In order to achieve this, I have a Django Form to capture the user's general information which POSTS to Django view 'A'. The Form is displayed using a template which also includes ...

Add a select box on the right admin filter in django - how to do ?

Hi, I want to used select box on my admin filter on django. FOr now django used list_filter on the admin model, and add a list of all data list_filter = ('data') and show : filter data - data1 - data2 - ... but if i v thousand data, i see a big list drop down my admin page... Is it possible to show a select box with the lis...

Django: form that updates X amount of models

Hello, I have a page where it displays a filtered model instance list and allows users to update some fields of it or add new fields as a form. I am curious what wpuld be a clever way of doing this, to delete and resave all the input data or make comparison for each data and save edited / new fields& entities. I would like to mind you ...

Django, extending admin's templatetags

I want to add an templatetag to the django admin, how can I go around extending the existing tags without needing to fudge in django.contrib.admin.templatetags? Update: Using {% load mytemplatetags %} in the admin templates breaks my server for some reason (im using nginx and throws me a bad gateway for that page). But the file mytempl...

Pre-interpret Django site at deployment time

I deploy Django apps using a fabric script that checks out a copy of my project and when everything is in place the source is symlinked and the web server is reloaded (guessing this is a typical approach). My concern is that the first time the site gets hit after deployment all the python scripts need to be re-interpreted. I have some ...

Django post save signal add an object into a manytomanyfield on the sender instance

I am using a post_save signal on an instance. In the callback I would like to add elements to the ManyToManyField of this very instance (named 'locales'). Here is my code: def after_insertion(sender, instance, **kwargs): locale = Locale(locale='en') locale.save() instance.locales.add(locale) Locale instance is created but...

Add a custom button to a Django application's admin page

Hi, I have an application in Django with a routine which would be available only to the admin. I'm quite new to the python/django world, so maybe my question is trivial. What I want to do is add a button to perform the routine in this application's section of the admin app. I'm quite confused from there, am I suppose to make a template ...

django form doesn't work on click submit

Hi! I'm trying to do a form, with gender choices. The user could choice between male or female. What I have now in forms.py: class GenderForm(forms.Form): demo = DemoData.objects.all() GENDER_CHOICES = [ ('Male', 'Masculino'), ('Female', 'Feminino')] gender = forms.ModelChoiceField(demo, widget=Select(), r...

How do the big sites handle immediate schema changes whilst using Django?

I've been using south but I really hate having to manually migrate data all over again even if I make one small itty bitty update to a class. If I'm not using django I can easily just alter the table schema and make an adjustment in a class and I'm good. I know that most people would probably tell me to properly think out the schema way...

Selecting a Python Web Framework

Hello everybody. This may seem like a subjective question. But it is not (that's not the idea, at least). I'm developing an Advertising software (like AdWords, AdBrite, etc) and i've decide to use Python. And would like to use one of those well known web frameworks (Django, Cherrypy, pylons, etc). The question is: Given that it will ...