A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [django]

Django is a Python-based framework for creating web applications.

Filter by
Sorted by
Tagged with
8
votes
1answer
97 views

Save 2 related models through a single form

Here are two models - Property and Developer: ...
3
votes
1answer
36 views

Updating multiple membership plan expiration dates at once

I have model action in RequestAdmin like this: ...
3
votes
1answer
626 views

Storing folders of list of records in Google Drive

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
0answers
499 views

Returning JSON from GeoDjango QuerySet and Display using jQuery/AJAX

I have this query: ...
0
votes
1answer
101 views

User and Score models

I have a couple of models - User & Score. I am displaying data from those models to my template. Data from ...
3
votes
1answer
139 views

Django view and template for a virtual zoo

I have a Django view and template that work together, but I think I probably did things in a crappy way. I basically have many dynamic values that I want to display on the page, and in two different ...
3
votes
1answer
790 views

Transaction.atomic with continuations

I have a view that looks like this: ...
5
votes
1answer
156 views

First attempt at weighted search

My concern is speed, since this may be used in an e-commerce website I want it to be as quick as possible. Where can I improve? ...
2
votes
2answers
141 views

Optimisation of a forms.py for a survey application

This is my forms.py for a small survey application I am developing. I previously posted some of my models.py. I am completely self-taught and am just looking for advice on how to improve. Any advice, ...
3
votes
1answer
54 views

Optimisation of a views.py for survey application

I have developed a small survey application in Django 1.6.2 which requires that the participants fill out a number of questions over 27 pages using a ...
3
votes
2answers
42 views

Fetching BasicInfo, BillingInfo, and DocumentInfo objects

The repetition is super obvious here. How can I rewrite this code? I need one base method in which I pass a Django model, to call objects.filter, but I can't figure ...
2
votes
2answers
537 views

Django Person Model created from forms.ModelForm

This is the current iteration of my first model of a Person. The model is populated by a survey application using forms.ModelForm and a ...
1
vote
1answer
72 views
1
vote
1answer
73 views

Organizing museum artwork

I have a small Django project to help organize museum artwork. In my models.py file, my museum object is defined as follows: ...
2
votes
1answer
479 views

Return JSON data based on GeoDjango Queryset

My code below returns a JSON data based on user's input or query in my HTML page or template. However, I need to modify or do some tweaking with my JSON data in order for me to use it in my datatables ...
2
votes
1answer
19k views

An array of dictionaries; comparing each {key, value} pair; and combining dictionaries

I'm trying to optimize a nested for loops that compares an element in the array with the rest of the element in the array. There's two part, the first part is for example, an Array has 3 elements, ...
1
vote
0answers
83 views

Correct, DRY, and efficient use of Django Managers?

I'm writing a custom Manager for my django app that lets you group django-enumfields: ...
15
votes
1answer
341 views

Modeling a Mage character from nWoD, using Django

Goal Design a representation of a mage character from the World of Darkness RPG, as well their associated spells. Here is a visual representation of the schema. You can see it more closely on ...
2
votes
1answer
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 ...
3
votes
1answer
553 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 ...
1
vote
1answer
816 views

Book database for a library system

I am writing a book database, and ultimately a library system, in Django. When a book is created without a title set, the ISBN will be used to automatically fetch book data from WorldCat I have just ...
2
votes
0answers
377 views

Task for all objects in model with datetime operations

I created this quite important piece of code, but I am not pretty sure is it good enough. Goal: I have a big task for a database and have decided to use Django-Celery. I want to go through all ...
3
votes
1answer
644 views

Try to implement comments tree for Django

I've tried to create an implementation of a tree for comments. I want use it in Django to store comments. Please tell me how to implement it much simpler, without recursion, to find child nodes. <...
1
vote
0answers
268 views

Use of get queryset and using pass to ignore an exception and proceed in my django view

I wrote a view to update my draft object. Before updating my draft I need to see if any draft exists for package(draft.package) in db or not. If any draft is ...
0
votes
1answer
166 views

Dynamically calculate status in MLM

Problem: dynamically calculate status in MLM only based on a structure. It works correctly but it's so slow. Only test processing takes about 20 seconds. I tried to replace some lists by generators, ...
1
vote
2answers
820 views

Class for multithreaded insert into database

Here I have class that supposed to take dictionaries of product objects and their articles (kind of unique identifier) from queue and insert or update them in database table. Received dictionary ...
3
votes
0answers
186 views

Finding Facebook Friends on app, and not on app [closed]

This code gets all of a user's Facebook friends who use our app and returns a dictionary with keys that are their id's in our database and values that are a default connection level. The code should ...
6
votes
2answers
173 views

What are the latest Odds?

The main problem the following query is solving, is the following: Each Offer has multiple Odds (...
5
votes
1answer
152 views

Personal Project for managing Bookmarks - View Part

The code is the view part of my bookmarker - project for managing bookmarks by categories. It uses Python 3.4/Django 1.6. I have also included models.py for ...
4
votes
1answer
180 views

Django template block name changing function

I created a reusable function for changing block name in Djago templates. I want to know if the code is good or is there any probable issues in it. I developed the function as a hack for the following ...
7
votes
1answer
143 views

School applicant form

I have created, in Django 1.6, a site for a school, where an applicant can get registered. It's a form that requests some information from the registrant and creates a random code for each applicant. ...
2
votes
1answer
2k views

Django template filter - sort by multiple keys

I have prepared an implementation of sort_by_keys filter: ...
1
vote
1answer
276 views

Efficient Django model for blog post

I'm currently trying to create a travel blog using Django whereby users will be able to create a travel plan with the following features: Each user can create a travel event based on the start date ...
1
vote
1answer
283 views

A `get_context_data` method for selecting and updating images displayed to a user over a multi page form

Below are the get_context_data method and the done method of a SesionWizardView. A SessionWizardView is designed to split a form over multiple pages. The ...
3
votes
1answer
36 views

URL selection function that is designed to randomly assign users to different surveys until full

I'm trying to condense some of my code to make it more maintainable and to learn a few new tricks. Below is a Python 2.7 / Django 1.6 function which is designed to assign users to one of three ...
6
votes
1answer
3k views

Improving models for a Django quiz

I'm working on a little django quiz taking app. Currently I'm making it's models. So far I've got Quiz, Question, ...
1
vote
0answers
1k views

Django Model field naming convention for lookup tables

I'm currently in the process of refactoring a Django app to use Django REST Framework. Within the existing code there are 15 models for lookup tables. The structure of each model is as follows (using ...
4
votes
1answer
79 views

CRM for a web host

I wrote an application which runs correctly, but I just want to have some feedback on it. Is there something unnecessary, or could there be something more pythonic, or did I write some code which ...
3
votes
1answer
2k views

jQuery slider in a Python/Django SessionWizardView

I have created a Data Verification page in a Django SessionWizardView where a user has to confirm an earlier submitted rating of an image using a jQuery UI Slider (-...
3
votes
2answers
1k views

Django ListView with MySQL query for the queryset

(Note: Even if you don't know Django, it's probably the query that needs work anyway, so you probably don't need to know Django/Python) I have a ListView that ...
4
votes
1answer
751 views

Simple Django website with no authentication. For auth/testing tutorial — Model, model-tests, urls.py, and settings.py only

I am writing a simple Django project which has no authentication at all. It's going to be used as the basis of a tutorial I'm writing, on the full authentication lifecycle (create account, login, ...
3
votes
2answers
99 views

Optimising and condensing Django View Class

This follows on from a previous question I asked which was of huge help to me. I am still only learning Python and Django and I would love to learn how to code better. The below is a ...
25
votes
3answers
833 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 ...
12
votes
1answer
4k views

Replacement for commit_on_success

I am porting an application from django 1.4.5 to django 1.6.1. I found that commit_on_success has been deprecated. Moreover I found specific incompatibilities when ...
2
votes
1answer
177 views

Reduce and condense a non standard SessionWizardView

As I'm slowly getting the hang of Python and Django I'm becoming increasingly worried about the volume/quality of code I have. This is my first time building a Python/Django Application and I'm ...
2
votes
1answer
60 views

Are 2 Django URLs pointing at 1 view unorthodox?

I'm in the process of writing a private messaging system and I have 2 URLs which go to the same view (is that bad?). The logic behind this madness relates to the way user relationships are structured ...
2
votes
2answers
4k views

Upload and resize image

I have implemented following code to upload and resize image in Django. Please suggest ways to make it more pythonic. ...
5
votes
1answer
642 views

Recursive Django filter to output a list from user hierarchy

I need to create an HTML unordered list (to display with jstree) to display the hierarchy of users, along with a list underneath the user's "subusers" of their comments. Each user could have many ...
3
votes
2answers
1k views

Django class-based generic views - am I doing it right?

I am working on a simple "to do list" app in Django (two models: List and Item). I'm trying to learn and make use of class-...
4
votes
2answers
9k views

Django Custom Decorator for user group check

I wrote a custom decorator to check whether user is in particular group of not. Please provide the feedback on optimizing code. I currently moved from Java to Django-Python so I wasn't able to ...