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

learn more… | top users | synonyms

-3
votes
0answers
12 views

Re-use the same template for a similar job [on hold]

I ask to a client to provide us a list of documents, e.g., ['doc1', 'doc2', 'doc3', 'doc4', 'doc5']. From this time, each 24 hours for 5 days, we send an email to ...
2
votes
0answers
27 views

A Django EAV attempt

This seems to do the job of the EAV tables. Besides being EAV, is there room for improvement? Maybe there is something obvious, but how about indexing certain columns? ...
2
votes
2answers
53 views

Unpacking tuple from Django's get_or_create function

Django's get_or_create function returns 2 values: the object and a boolean whether it was freshly created or not. I'm only really interested in the object it ...
0
votes
0answers
28 views

Retrive data for Table from m2m through field is slow

The problem is in the for loop because it do many repetitions and they are slow. For generate a table 40x40 it need about 20 seconds (I will need a table 200x200). I think this is the relevant code. ...
-1
votes
0answers
20 views

Getting corrupted file in LogicalDoc with Django [closed]

I'm developping a important Civil State Project and I'm getting a problem in my script. Up to now, I don't find a way to solve it because I don't see where could be located the problem exactly. My ...
4
votes
2answers
72 views

Password generator in Django

I am a system admin, not a developer, so this might be pretty horrible code. This is a password generator. The point of the attempt was to become more familiar with Django at a lower level. I current ...
3
votes
0answers
23 views

Working with multiple currencies in Django

I'm working on a project where user adds many products and compare their prices, average price, minimal and many other statistics. There are two currencies for now, EUR and CZK. I'm here to ask ...
1
vote
0answers
89 views

React Redux quiz app

I started learning about React and redux recently and I created a dummy project based on drf-redux project and react-redux-quiz-game This application uses Django rest framework for API and React with ...
3
votes
1answer
34 views

Django BaseController

A working example of mine, trying to streamlining my Django views, with absolute inspiration from Laravel: ...
4
votes
1answer
61 views

Django query ManyToMany for tagged items

I've got a item inventory that each inventory item is tagged with multiple tags. What I've got is an API that takes a query parameter with multiple comma separated query items and returns a list of ...
1
vote
1answer
59 views

Django Forms and handling

I'm really new with Django and I would like to get your minds, advices, ... in order to improve the first part of my project. For the moment, I created a model form which is named ...
5
votes
1answer
73 views

Civil status database with Django

I'm beginning with Django and I have a Civil Status project. I created my first models.py in order to get a Form, but I had some advices in order to normalize my database. I made this process and I ...
1
vote
0answers
31 views

Django Notification Model with a generic relation

I wanted to implement notifications for my app, so that a user would know if another user, liked, commented on, or followed another user. It works, but I feel like it's very limited which I need to ...
5
votes
2answers
160 views

Abstracting celery tasks with class based implementations

Background I want to send emails with a rendered template (django template, that is) but I also want to be able to control the QuerySets, and context provided. The goal is to make a task whose ...
0
votes
0answers
32 views

Generating Django fixtures from .csv

I've written this script to create a Django .json fixture starting from a .csv. The .csv must have 'model' and 'pk' fields. What do you think? ...
3
votes
1answer
209 views

Storing database references to files/media

This is an extension of this question due to it not covering an important role of my setup that I think needs more attention. The files are stored on a different server for separation and convenience....
1
vote
0answers
78 views

Django REST custom methods for generic views

I'm intern and work on a project where I develop DRF API that need to interact with mobile app written by my colleague with Ionic framework. We are creating new user. My view method is following: <...
3
votes
1answer
56 views

Backup MySQL database for Django projects

I have a usual Django application with a single MySQL database. The purpose of this shell script is to backup a MySQL database every midnight by crontab and check that everything goes right. The ...
5
votes
2answers
261 views

Generating a unique ID for a filename

This function generates a unique id for my files, which will be stored in the database to reference them. It returns the id if unique, if not, it generates a new one. My separate file server can then ...
2
votes
1answer
51 views

Using mocking to test that a Django view renders as expected

I have a Django view that ends with this... return render(request, 'define/see_all.html', context) I have mocked the render function and ...
2
votes
0answers
22 views

oAuth2 token creation when registering new user

I am working on Django Rest Framework for backend to develop android app. My project is about Food Delivery System. My app has user login and registration feature. I preferred oAuth2 for token based ...
2
votes
2answers
184 views

Method to return the lowest filename number not being used

I have a Django site where users upload and have the option to delete files. There will be a lot of files that will have the same logical name so I append numbers to them: ...
1
vote
1answer
46 views

Django class based view URL API

I kind of started making an API for my site in a Django class based view because it seemed logical and now it has gotten quite large and unruly and I am starting to wonder if I am doing this correctly....
3
votes
2answers
298 views

Model design for Online Food order app

I have been trying to develop online food order application. I have taken the concept of zomato.com where a user or say owner registers his/her restaurant. After adding the restaurant, an executive ...
2
votes
1answer
34 views

Dynamic Official Receipt increment algorithm

I made a function that would automatically generate official receipt for POS. it is able to accept format such as xxx, xxx-xxx, xx-xx. But my code is really messy and horrible and it needs review. I ...
3
votes
1answer
42 views

Profile creation

I was creating a view with Django that would create a user profile for a website and this is what I came up with: ...
3
votes
0answers
34 views

One user profile for company and person

I'm creating a web page which has two types of users with very similar permissions: Person and Company. The main difference is ...
0
votes
0answers
94 views

Django 1.9: Compare two different approaches of creating 2 types of User

I'm trying to figure out which would be more efficient way to create 2 types of Users in Django (v 9). I've add a question on StackOverflow. User Sardorberk ...
0
votes
0answers
20 views

Rendering a confirm page before saving form to db

I would like to hear your opinions on this approach. The thing I do is that I have one page where the user can fill the form - order. I want user to fill the form, then click on the 'next' button. ...
1
vote
0answers
29 views

Creating multiple objects using two forms

I would appreciate if you check my code and tell me what should I change. The code finally works but it could be much clear in my opinion. This is all about creating an ...
6
votes
2answers
103 views

Django controller method to list the top characters, guilds, and killers

I've been reading the Chapter 8 of this book. Here's the view I'm currently coding. It list all characters/guilds according to the type of URL. ...
3
votes
1answer
45 views

simple form validation

i've just started to learn python /django .. im coming from php world ...i mostly struggle with None values which are new to me .. in php i mostly did my boll checking with true/false but in python ...
-1
votes
1answer
98 views

Idiomatic Django conditional filter queryset

I am sharing a viewset between two types of routes in Django: one is a nested route (/users/:id/comments/:id/), and a regular route (...
1
vote
1answer
94 views

Validating Email Addresses without DB

I wanted to put this out here and see if there were any security vulnerabilities that I'm not seeing. Also, if I can improve performance without sacrificing security, that's always a plus. Thanks in ...
-1
votes
1answer
505 views

Django query filter on count in one to many relation

I have the following models: ...
1
vote
1answer
79 views

Get time slots based on multiple workshops

I have a list of Workshops, each having open days (Monday, Tuesday etc.) and open time and close time (which will be same for each day). Now, Based on the current time, I need to find out next 7 days ...
2
votes
1answer
133 views

Loading data from a text file into the database as fast as possible

I'm building a Django (1.8.12) application that parses a .bc3 file (Standard Interchange Format for Databases of Construction and Real State) and loads all the data into the database (PostgreSQL 9.3.9)...
2
votes
1answer
52 views

Auto registering class registry

I built this auto registering registry to look into a package and import all modules and register any classes that are a subclass of a base class. I use it as a registry for a model's choices in ...
2
votes
1answer
35 views

improvement of a database register function

Here is a function in a django rest api, that takes data in json and registers a category for a given website. I'd like to merge two try...except parts that check <...
4
votes
1answer
230 views

LRU caching decorator that caches in the instance and in a shared cache

I needed a caching decorator, that could be used with methods and functions, that could take typed args and kwargs, and that was Python 2.7 compatible. Therefore I started with a backport of the <...
4
votes
1answer
76 views

Selecting all posts created by user that actual user follows

I have a view that displays posts created by users that actual logged in user follows. It works, by I think the way I've done it isn't good. BTW, UserProfile is my default user model. UserFollower ...
2
votes
1answer
103 views

Registration in Django

Can you say, is this a bad code for registration in Django? Do I need to fix something or use a pip instead? (I am learning) ...
5
votes
1answer
172 views

FIFO inventory allocation method

I am an owner of a small industrial business startup and I am learning to write software in order to efficiently keep track of our inventory and finances, as our needs have outgrown the capabilities ...
5
votes
1answer
109 views

Handling SMS replies to register/unregister phone numbers

I'm working on a Django Twilio app, and I believe it's coming along well. I just want to improve my code writing skills. How can I improve the below code? ...
3
votes
2answers
77 views

Object oriented architecture with an image processing code

This code is python 3X code (in django). It takes an instance of user entry, and process images: it creates a resized version of original image, 2 thumbs, saves all, and update instance fields to ...
4
votes
2answers
306 views

Django views for banking operations

How can I Pythonize/Djangoize/DRY my Django code? views.py ...
4
votes
2answers
281 views

Bank account model implementation in Django

There is a draft of my models.py. What can I do for code quality and readability increase? ...
5
votes
1answer
933 views

Model classes for a quiz app in Django

I am creating simple quiz app in Django. It works, but I think that way I've done it is not the best. I have Exam detail view, which display questions related to that exam and answers for these ...
1
vote
0answers
39 views

Delivering groups of online reports

As part of my present project, I revived the task to deliver group of online reports. As per a report's complexity and best performance on my radar, I decided to write SQL view on PostgreSQL and next ...
3
votes
1answer
62 views

Mapping different classes to the same database table

I have several very similar subclasses that I (think I) want to be stored in the same database table. Most of the fields are identical, with each subclass adding 1 or 2 custom fields. My code is using ...