Questions tagged [django]
Django is a Python-based framework for creating web applications.
323 questions
1
vote
1
answer
461
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 ...
2
votes
1
answer
163
views
Django how to make this view faster?
I have view and it works correct, but very slow
...
7
votes
1
answer
78
views
Finding the profile name for a join in my Facebook auth backend
I've written a project for handling various Facebook things and I ran into the issue where one project named the users profile Profile while normally they would be ...
5
votes
1
answer
484
views
Python parser for attributes in a HAML template
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:
...
2
votes
1
answer
610
views
Need advice of refactoring views.py
I setup simple CRUD in Django
...
2
votes
3
answers
89
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 ...
1
vote
2
answers
726
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.
...
3
votes
1
answer
311
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
1
answer
557
views
Mobile content delivery system
For flexing my newly acquired Django & Python muscles, I have set up a mobile content delivery system via Wap Push (Ringtones, wallpapers, etc).
The idea is that a keyword comes in from an sms ...
4
votes
2
answers
346
views
Decorator to take away repetitive code
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, etc).
...
3
votes
1
answer
1k
views
i18n translator using Jinja2
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 ...
2
votes
1
answer
5k
views
Parsing and data presentation in Django
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 current approach is like this:
I ...
2
votes
3
answers
242
views
Django view function
I have a view function that allows a user to Add / Edit / Delete an object. How does the following function look, and in what ways could I improve it? I was thinking about separating aspects of the ...
2
votes
1
answer
460
views
Django Team Sport class
So this isn't EXACTLY my code but it is close enough to show what I have. Also the naming is only for this site so if its not really clear forgive me. Its much clearer in the actual code.
...
1
vote
1
answer
190
views
Separating a view function by action
I have one large view function where a user can Add, Edit, Delete, and Update his education. I am currently doing this all in one view because I haven't yet learned how to split up views by function. ...
4
votes
1
answer
19k
views
Multiple forms in django
I have an account page where I have three forms. A user can change his name, his email address, and his password.
There are two difficulties I am having from trying to do this:
the request.user ...
5
votes
1
answer
671
views
How would you rate this python code? (Django AJAX)
This code comes straight out from the example code in a Django book. I find it quite bad, mainly because the use of flags (if ajax then again ...
4
votes
1
answer
7k
views
Three-table queryset (full outer join?) in Django
I've got three tables I need query to display to a user for a web application I've written. Each table (Url, Note, Quote) has a foreign key relation to the User table. For every User, I need to sort ...
5
votes
3
answers
418
views
Todo app for displaying a list of tasks
The main view in my (toy!) Todo app is, of course, to display the list of tasks. These are grouped by some criterion, and the tasks structure below is actually a ...
5
votes
2
answers
505
views
Converting an already-uploaded file and saving it to a model's FileField
Please review this:
...
6
votes
1
answer
41k
views
Django query_set filtering in the template
Can I make my template syntax simpler? I'm hoping to eliminate the if and maybe also the for block.
This worked in the shell ...
11
votes
2
answers
2k
views
An idiom to use the same view function to create or edit an object?
Here is the skeleton of my (first!) Django app:
...
25
votes
3
answers
899
views
Music info model
I'm learning Django as I go. I know this model is missing user authentication, registration, comments/comment threading, and voting. But this is my starting code for my model. What are some of the ...