2
votes
1answer
69 views

faster Django csv generation on the fly

I am writing a csv file generator that's filtering through about seven million db entries. {mySQL backend} This part is especially slow and I was wondering if there is a way to make it much faster. I ...
-1
votes
2answers
62 views

Unpacking sequences for functions

After watching Raymond Hettinger, I decided to go through my code and make it faster and more beautiful. The example given on the slides is, unfortunately, not good enough to get me going (ref. ...
3
votes
1answer
95 views

Python/Django Script - Is it crap? Objects duplicated or passed?

I've written a script using the Django ORM to store 'configuration settings' and interacting with the Google Drive API and another API. The script creates a base project folder and subfolders in ...
1
vote
1answer
56 views

POST data handler

I have written a function to handle post data received from a web page. The Emphasis is on making getting post data easy: using the function allows the coder to specify the required data, type, and ...
1
vote
1answer
56 views

Django how to make this view faster?

I have view and it works correct, but very slow class Reading(models.Model): meter = models.ForeignKey(Meter, verbose_name=_('meter')) reading = models.FloatField(verbose_name=_('reading')) ...
3
votes
1answer
156 views

Feedback on a small Python parser

I'm working on a feature for the HamlPy (Haml for Django) project: About Haml For those who don't know, Haml is an indentation-based markup language which compiles to HTML: %ul#atheletes - for ...
2
votes
1answer
116 views

Need advice of refactoring views.py

I setup simple CRUD in Django from django.shortcuts import render_to_response from django.template import RequestContext from django.core.urlresolvers import reverse_lazy from django.http import ...
2
votes
3answers
63 views

Building and getting a form of objects that have multiple properties

I'm building a form dynamically in a web app where I'm using product_id to keep track which product I'm reading and then product_<id>_property to grab the value of it. Then in my view I end up ...
1
vote
2answers
66 views

Doubts about db_index, primary_key and unique parameters

I'm trying to improve my code. I've some doubts about db_index, primary_key and unique parameters. # -*- coding: UTF-8 -*- from django.db import models from django.contrib.auth.models ...
3
votes
1answer
166 views

Am I being too redundant in this Django view (or can I reduce the repetition in my code)?

I'm new to Django and learning my ways around it. I'm writing a fake basic CRUD app to get me started. In the following code I pretty much copy and paste the same code four times with minor ...
3
votes
1answer
189 views

Polymorphism in Django models

For flexing my newly acquired Django & Python muscles, I have set up to do a mobile content delivery system via Wap Push (Ringtones, wallpapers, etc), old fashion but it is an exercise! I have a ...
3
votes
2answers
190 views

Is this a good python design?

I'm using django and i wrote this decorator to take away some of the repetitive code i found for ajax views and i want to know your opinion (too basic, bad design, try this instead, ok, etc). def ...
1
vote
1answer
204 views

Can you review my i18n/Jinja2/python code?

I'm learning to Jinja2 and what's important in this case isn't speed but i18n translations and functionality. With python 2.7 Jinja2 and not django seems to preferred way to go so I'm rewriting much ...
-1
votes
1answer
428 views

Can you review 1 line of code here?

Hi I hope you can comment when I include the largest file of my largest project. There is more available if you feel like code review. I think my project needs daily code review for some time. The ...
1
vote
1answer
2k views

Python XML parsing and data presentation in Django

I hope this is not a duplicate. For some time now, I've been using a pattern which I think could be done more elegantly. I have a lot of XML files that need to be represented in a Django views. My ...

1 2
15 30 50 per page