Questions tagged [django]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
37 views

Is the given code optimized ? Can it be optimized?

I have a dashboard where I have to show the Charts and graphs for weekly sales(7 days before including today) , monthly sales(12 months before including this month) and profit/loss got in 7 days with ...
user avatar
1 vote
0 answers
16 views

Django data migration - worked, but far from performant

Background: I am learning web dev and decided on the Django framework as an excuse to learn Python at the same time. (Background is stats with lots of R and ...
user avatar
1 vote
1 answer
72 views

Python module to generate context for Django template using data requested from API

As part of a university assignment, I have been tasked with populating and rendering a provided Django template with COVID-19-related quarantine data retrieved from a government API. To challenge ...
user avatar
  • 15
2 votes
1 answer
60 views

Django User Model to authenticate using email address and password

This is my second Django project for an actual client and I want some review on one of my important models. This model will be responsible for authenticating users using their E-Mail Addresses and ...
user avatar
0 votes
0 answers
39 views

django - Storage class url method

I have a dropbox storage class inheriting Storage (see below). url method is going to run on each image render, causing back and ...
user avatar
2 votes
0 answers
35 views

Create a more efficient and performant csv import function with Python Django

I am creating a website for users to track their Magic the Gathering inventory. I have created some functionality to import a csv to easily add cards to their inventory. The functionality works as ...
user avatar
  • 327
0 votes
0 answers
23 views

Possible to merge model method database calls?

I have an application using Django Rest Framework and a ListModelView for a model which I basically need to filter for in a MongoDB. The call for MongoDB is made in ...
user avatar
  • 165
1 vote
0 answers
44 views

Reduce db queries

my models ...
user avatar
1 vote
0 answers
62 views

Execute a third party API call for every object in my queryset in a Django ListView

I have a ListView that displays every customer (class Cliente in my code) of a company. Every ...
user avatar
0 votes
0 answers
37 views

User's models with different roles

I wan't to set different type of users in my app, two main types: Customers and Employee, and the Employee User's have two different role: Driver and Responsable. So I extended the AbstractBaseUser ...
user avatar
6 votes
1 answer
196 views

Get list of claims based on priorities

I have written the following function which works as expected but I still see there is some room for improving its readability ...
user avatar
2 votes
0 answers
63 views

Generate breadcrumbs from URL in Django

For Django sites with URLs structured in a hierarchical way I found it helpful to have an app to quickly transform an URL like ...
user avatar
  • 305
1 vote
0 answers
11 views

Check if Profile name is contained in Tagged Profile names: added link

I have a function which checks for a profile name and determines if it is in a tagged profile name. ...
user avatar
1 vote
1 answer
57 views

Wanted to eliminate the repetition in the classes created to reduce duplication

Can some one help me on how to eliminate repetition to reduce duplication score on the below classes created in the code ...
user avatar
1 vote
0 answers
18 views

processing webhook request coming from a 3rd party application

I need some help to evaluate whether I am doing it right. The scenario is, a 3rd party application is sending a webhook request after a successful payment but the problem is that sometimes this ...
user avatar
3 votes
0 answers
36 views

Logical next step in Django newsfeed web app

I'm hoping to get feedback on my current code from someone more experienced in Django, and in the concepts I'm trying to implement. Let me preface by saying that I am a novice to Django. This is my ...
user avatar
3 votes
1 answer
201 views

Node backend to run user-submitted code in a virtual machine

As per the title, I'm making a webapp that is intended to use as a JS exercise platform. Problems are shown to users, they submit code, that code is run against a few test cases, and a report of the ...
user avatar
1 vote
0 answers
26 views

Django Models for an ESL school

I am working on building a management interface for an ESL (English as a Second Language) institute, basically it is a language school where people learn English. I have prepared my models for each ...
user avatar
0 votes
0 answers
52 views

Managing friend requests on a social media website in Django

So i created a social media website in django and here is how i managed accepting friend requests and showing friends posts in home page. Would it be better to do this operation in models.py file, ...
user avatar
3 votes
1 answer
299 views

Email verification resend implementation Django

I'm trying to build an email verification for user signup using CreateView. This view check whether the user is a new or already existing inactive user? and resend ...
user avatar
3 votes
1 answer
42 views

Find best candidates in efficient way, Django

I'm beginner in django and python. I have models : ...
user avatar
1 vote
0 answers
41 views

Global Dictionary Class

For a Django-Server I use several custom Error-Codes, error-titles and descriptions, possibly other fields might follow. I'm using right now a basic global dictionary. ...
user avatar
  • 141
3 votes
1 answer
302 views

eLearning webapp made with Django

I've been working on probably my biggest project yet, and I'd like you guys to give me some feedback on the code I wrote so far. It's an eLearning app which offers users a host of functionalities to ...
user avatar
2 votes
0 answers
35 views

Set logged-in USER in a Form requiring Current User Credentials

Currently, I can set the the current_user in the views.py for a form, which requires the user...
user avatar
0 votes
0 answers
43 views

How to configure view to carryout two operations from GET request Django

I'm trying to build a wish list for my website. So I created a view that will render out the wish list and to add items to the wish list - using ajax Those two tasks are carried out by the same view....
user avatar
3 votes
1 answer
222 views

How can I refactor the validation code to minimize it?

I am using Django Rest Framework and below is the code of one of the API Endpoints. The code creates generates the PUBLIC and SECRET Values based on Stellar SDK. ...
user avatar
  • 131
-1 votes
1 answer
91 views

django multiple if else refactor

I have a function with multiple if else statements that I'm trying to simplify in Django Is there a pattern or maybe a better modeling approach that I could use here? The idea behind is to have a ...
user avatar
2 votes
3 answers
93 views

Task-list app, which allows to add and remove tasks from list

I wrote my first web app. Please let me know what I should improve. I want to write as clean code as possible. App is about adding and removing tasks from list. Backend is written in Django, frontend ...
user avatar
3 votes
0 answers
40 views

Handling System Check message identifiers with Django

Django implements a System Check framework that enables apps to perform checks on settings, runtime, etc. When creating an app, one can plug checks with the framework by following some requirements, ...
user avatar
0 votes
2 answers
27 views

Template file for creating formatted webpages

This is my working template file which I manually edit to create new properly formatted webpages for my personal website. I am interested in what advantages if any could be realized by placing the CSS ...
user avatar
5 votes
2 answers
232 views

Mapping column names and values of a csv using another csv

I have two csv files, pricat.csv which contains objects I need to populate my DB with, and mapping.csv which specifies how the ...
user avatar
1 vote
0 answers
81 views

Get user and users of ancestors of a model instance if it has `organizationmember` attribute or else only user of the instance in Django

I have the following models: ...
user avatar
  • 111
2 votes
0 answers
25 views

Google Mailer app inside Django using OAuth 2.0

I have built this Django Package which is an alternative for sending mail to users using Gmail API. Everything is working fine. But the verify(self, request) method inside ...
user avatar
  • 121
3 votes
1 answer
438 views

Django Calendar Model

I am building a doctor appointment app with Django and Django Rest Framework. The app will have the functionality for secretaries to add appointments to a Doctor's calendar, and each Doctor may have ...
user avatar
  • 231
1 vote
0 answers
16 views

Django: View method that outputs large context data into an html dashboard template

I'm a beginner in Django3 and just wrote an overview function to pass on some data to the template in a context variable. I am definitely passing a lot more than I should as I only need only a few ...
user avatar
  • 1,061
5 votes
1 answer
82 views

Twitter contact scraper with Tweepy & Django

I created a project for academic purposes that works on Twitter data. It should: Get all friends and follows of the user Store them in MongoDB Display them in a table I'm using django + plain HTML, ...
user avatar
1 vote
0 answers
49 views

List some things that to make it less verbose and more robust

I am quite new in django forms. I am woking on problem where in function name generate_outage_form passed two parameters name settings and segment Now I have to make function less verbose and more ...
user avatar
1 vote
1 answer
1k views

Test django URLs

I started learning Django and now I want to write some tests for my application. After reading some blog posts and watching youtube tutorials I wrote tests for URLs. Look at below. urls.py ...
user avatar
6 votes
0 answers
250 views

Xero API Client in Django

I'm not actually that new to writing Python. But I've no formal training and have only learnt to build applications to solve problems for my job out of necessity. Starting to bring my existing skills ...
user avatar
  • 61
2 votes
0 answers
95 views

Model and form validation in class based view

In an app which it is possible to transfer money between accounts I have the following logic: View: ...
user avatar
  • 21
3 votes
0 answers
33 views

Command Line Utility for Starting Django Projects and Apps with Custom Files

What I'm Doing I'm writing a command line utility for starting Django projects and apps with custom files. The custom files build upon what Django offers, to make sure things like a custom auth user ...
user avatar
  • 131
1 vote
0 answers
332 views

Disabling the delete() method in Django managers and querysets

I had problems with related objects not deleted when deleting objects in bulk in Django, so I disabled the delete() method in Django managers and querysets. I also ...
user avatar
  • 191
2 votes
1 answer
221 views

Keeping history of Django model (by using memoization?)

I'm working on a Django project for which I'll need to store the historic information of many models. So far, I'm using the following strategy: Memoize the relevant values in ...
user avatar
  • 131
1 vote
0 answers
23 views

How to eliminate repetitive serializers and API Viewsets in Django Rest Framework

I built an backend using Django and the django-rest-framework and realized that a lot of the code snippets (mainly classes) are similar. Is there any better way? I tried to wrap them into a very ...
user avatar
  • 165
3 votes
1 answer
52 views

Scraping weather conditions for mountain peeks

I have built a website in Django in which I tried for the first time to create a complex app. It's an app that scrapes weather conditions on a peak in mountains, which are 17. I wanted to show a ...
user avatar
1 vote
0 answers
1k views

Limit choices for Django admin filter_horizontal interface

The Django ModelAdmin offers a filter_horizontal (or filter_vertical) interface for many-to-many relations, which allows the ...
user avatar
  • 151
3 votes
1 answer
142 views

Python REST API and Mongo - Aggregation Pipeline/Stage classes

This has been my approach for "simplifying" MongoDB aggregation queries in a pythonic syntax - was my intent, at the very least: ...
user avatar
  • 133
1 vote
1 answer
805 views

Best practice for URL's architectural Design in Django [closed]

I have been designing websites with Django for a while and I have also designed various sites. But here is a question that comes to mind at the beginning of any new project: What is the best URLs ...
user avatar
3 votes
2 answers
175 views

Make django, weasyprint code object oriented

Please ignore the comments in the code for the purpose of reviewing. I just require tips on using SOLID principles and how classes can be used in this code.Comments in the code are for mapping the ...
user avatar
3 votes
0 answers
855 views

Product inventory database with attributes and variants

I have design a model for product apps. This is the first time I am trying to create a product's database schema and then model it in Django. My code handles the following: A product type can have ...
user avatar
  • 211

1
2 3 4 5
7