django

Django - complex forms with multiple models

Django 1.1 models.py: class Property(models.Model): name = models.CharField() addr = models.CharField() phone = models.CharField() etc.... class PropertyComment(models.Model): user = models.ForeignKey(User) prop = models.ForeignKey(Property) text = models.TextField() etc... I have a form which needs t...

Hiding the time in a datetime model field in Django?

I'm using Thauber's lovely Django schedule app, but have run into a problem: I can't figure out how to exclude the time portion of the datetime field. My form class and lame exclusion attempt looks like this: class LaundryDeliveryForm(EventForm): start = forms.DateTimeField(widget=forms.SplitDateTimeWidget) end = forms.DateTim...

Geopy in Django: JSONDecodeError

Hello, I have followed the tutorials in http://code.google.com/p/geopy/wiki/GettingStarted This works fine: g = geocoders.Google(resource='maps') I want to use json as the output format because I want to handle the results in javascript. BUT everytime I use: g = geocoders.Google(resource='maps', output_format='json') I get the e...

Django: Parse JSON in my template using Javascript

Hello, I have this in my view: string_location = myaddress2 geodata = [] for place, (lat, lng) in g.geocode(string_location,exactly_one=False): geodata.append((place, (lat, lng))) geodata_results = len(geodata) data = {"geodata": geodata, "geodata_results":geodata_results } return render_to_response("busin...

What exactly is a web framework?

Is a web framework, such as Django and Ruby on Rails, simply a way of displaying code that could be written normally over http? Or is it used for more server side things, such as storing data. Is it used as a front-end or back-end for websites? ...

Big picture questions regarding Django, Java, Python, HTML and web-site development in general

I am trying to get a handle on the state of the art regarding web site development and have several questions. Maybe I'll end up finding most of the answers on my own. I come from a background of C++ and Windows development, and generally I am befuddled by what seems to be the ad-hoc nature of web development. I focussed in on Django, ...

How do I force Django to ignore any caches and reload data?

I'm using the Django database models from a process that's not called from an HTTP request. The process is supposed to poll for new data every few seconds and do some processing on it. I have a loop that sleeps for a few seconds and then gets all unhandled data from the database. What I'm seeing is that after the first fetch, the pro...

Set custom 'name' attribute for RadioSelect in Django

Hi I'm trying to set custom 'name' attribute in django form. I've been trying this kind of approach: class BaseQuestionForm(forms.Form): question_id = forms.CharField(widget=forms.HiddenInput) answer = forms.ChoiceField(choices = [ ... ], widget=forms.RadioSelect) and then setting the 'name'-attr on answer with: form.fields['an...

soaplib problems with XML characters in string payload

I've created a simple SOAP web service using soaplib and run into an issue in which SOAP parameters sent including ampersands or angle brackets are ignored, even when escaped. Whether the method is set up to accept a primitive string or a primitive of type 'any', any of those characters introduced result in a webfault (using suds) of th...

embedding generated img inside django template

how would I embedded generated image inside django template? something like return render_to_response('graph.html', { 'img': get_graph() }) I don't want this - because it just send image http.HttpResponse(get_graph(), mimetype="image/png") ...

Error when trying make cleaned_data()! Django

Must be simple solution. But I do not see it. Please help me. Looks like 'gorod' is in request but when i trying cleaned_data() it gives me KeyError KeyError at /ticket/ 'gorod' Request Method: POST Request URL: http://localhost:8000/ticket/ Exception Type: KeyError Exception Value: 'gorod' Exception Location: C:\...

Django translation catalog is empty

Hello, I have my locale in my project directory and have set the packages as such: js_info_dict = { 'packages': ('my_project',), } makemessages works well as i have a djangojs.po file with my gettext strings but no javascript string ever gets translated on the website and the catalog is always empty. Thanks ...

Django image file uploads

I just can't figure out how to upload images in django. I've read dozens of blog posts and questions here, but most of them just confuse me more. Here is what I have so far. This is my model: class Post(models.Model): user = models.ForeignKey(User) screenshot = models.ImageField(null=True, upload_to="images") date = models.DateT...

DJANGO allow access to a certain view only from a VPN Network

Hello I am trying to specify the access to a certain django view only to a client calling from a VPN IP (10.8.0.3 ) My django server is supported by apache using the following .conf <VirtualHost *> ServerAdmin [email protected] DocumentRoot /home/project/virtualenvs/env1 ServerName client1.project.cl ServerAlias ww...

Non local connections for django project server

I ran the command python manage.py runserver 0.0.0.0:8000 It started the server up, but when I navigate to http://myipaddress:8000, my webbroswer doesnt connect. I also tried with my iphone safari brower and got the same thing. I am using Mac OS X 10.6 and am connect to the the internet through my router. Any suggestions on how to all...

persistant TCP connection in Django

Hi, I have a Django application which sometimes needs to send some data through TCP and I want this connection to be persistant. The way I wanted to do it was to create a simple Twisted TCP server (I'm the one who will be waiting for the initial connection) and somehow call it from a Django view whenever I would be needing it. How s...

Building a dynamic tree with session information in Django (template question)

Hi, So I've got a expanding/collapsing tree that I'm keeping track of in session data. I want to be able to render the tree in Django based upon the session data. I am saving the state with something like: request.session['treedata'][item_id] = state # (0 or 1) In my template for rendering, I'm looping through the items and for e...

Sending data to django site

I am trying to build a django service to which numerous clients will send data. Each client will represent an authenticated user, who might be connected to the internet or not, so the client will aggregate the data and send them when a connection is available. The data should also be persisted locally so that they are accessed quickly wi...

Is there a python implementation to .net automapper?

Automapper is a object-object mapper where we can use to project domain model to view model in asp.net mvc. http://automapper.codeplex.com/ Is there equivalent implementation in Python for use in Django(Template)/Pylons ? Or is there necessity for this in Python world? ...

Importing Modules (SQLITE3) from Python Virtual Environment

I am using a Windows machine with python, django, and pinax installed. I can import modules from any normal location (even if it's not in the actuall installed directory). However, I cannot import these same modules when I am in a virtual environment that I built for Pinax. What are possible causes of this? What are possible solutio...