All Questions
315
questions
2
votes
0answers
36 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 ...
1
vote
1answer
50 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
...
0
votes
0answers
57 views
Extract fields from email and store into a Django database
This code was written to capture extracted text from emails and store those details in a database.
I would like to reduce the amount of code, improve simplicity and reduce the duplication of my code. ...
1
vote
0answers
15 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 ...
3
votes
0answers
29 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 ...
1
vote
0answers
22 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 ...
0
votes
0answers
39 views
Stop Django Rest Framework API execution and return appropriate response
I am writing an API function using Django Rest Framework where it accesses many resources like AWS, Database, External APIs etc., I want the API execution to stop if it fails in any of the steps and ...
0
votes
0answers
36 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, ...
2
votes
0answers
52 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 ...
0
votes
0answers
20 views
3
votes
1answer
35 views
Find best candidates in efficient way, Django
I'm beginner in django and python. I have models :
...
1
vote
0answers
34 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.
...
3
votes
1answer
236 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 ...
0
votes
0answers
24 views
using a Built-in template tag “regroup” take long time to render result
I'm working on a project on django, I used the built in view ArchiveListView, and I want to sort records to be grouped by a common attribute.
So django ORM don't have a group by query, so I tried to ...
2
votes
0answers
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...
0
votes
0answers
33 views
Different Serializers for Different Methods in Django REST Framework
As I am developing my first real API, I encountered that I wrote a lot of serialisers and I think there could be a possibility to merge them together. For example I have this 3 distinct serialisers ...
3
votes
1answer
220 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.
...
-1
votes
1answer
61 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 ...
3
votes
0answers
33 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, ...
5
votes
2answers
131 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 ...
2
votes
0answers
23 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 ...
4
votes
1answer
255 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 ...
5
votes
1answer
60 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, ...
1
vote
0answers
43 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 ...
1
vote
1answer
170 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
...
6
votes
0answers
130 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 ...
2
votes
0answers
44 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:
...
3
votes
0answers
30 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 ...
1
vote
0answers
42 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 ...
2
votes
1answer
116 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 ...
1
vote
0answers
20 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 ...
3
votes
1answer
50 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 ...
3
votes
1answer
128 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:
...
1
vote
1answer
345 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 ...
3
votes
2answers
136 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 ...
3
votes
0answers
493 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 ...
4
votes
1answer
327 views
Use django engine to fill in a .html file on storage (no template) and use weasyPrint to convert it to PDF
I 'm new here. I wrote the following django code. I 'm opening, closing files here and saving them temporarily and deleting them. I tried to use Python's tempfile and was getting Permission Error and ...
1
vote
1answer
39 views
Statistics function
I have created a database using Django. I have a small statistics page as shown below. Can I improve this code?
View file
...
1
vote
0answers
2k views
One form for multiple models in Django
I must allow user to add city, state and country if it is not already present in the drop-down. Then I must create the respective model instances and then update the city in the userprofile. The below ...
1
vote
1answer
495 views
Am I dynamic filtering correctly in Django?
I needed a way to get URL parameters and put them and their values into a query set's .filter() if they exist. After a day of piecing together information from the ...
1
vote
0answers
16 views
1
vote
0answers
30 views
Modelling articals and authors in Django
I need to understand if the way I am modelling data in a Django application is correct. The idea is of a news site that has sources, authors and articles.
I want:
...
3
votes
1answer
63 views
Speed up Python Script to populate MongoDB
How would I go about making this script much faster? Essentially it reads from a file and the slowest part is populating the words. In the words file there are over 100k words and I was looking for a ...
3
votes
0answers
24 views
Django migration script to add metadata
I made a simple django migration that adds two field to our Invoices model : first_payment and first_paying_month.
...
3
votes
1answer
55 views
Django voting implementation
I am creating a translation application and the users can add new translations to the "core" language, e.g. a Latin translation of the German word, and other users can vote on this translation. A ...
2
votes
1answer
54 views
My Django custom user model
I followed a video on YouTube to create a custom user model, this is my attempt:
...
2
votes
0answers
28 views
Representing LXC component configuration in django
I want to represent components of LXC in django; so I defined them in models: Container, Network, Profile and Devices where each one of them have a set of attributs, but when it comes to representing ...
1
vote
0answers
562 views
two foreign keys in one django model [closed]
I'm working on a project the scenario: teacher model then is the teacher has not a profile the institute which working at will upload the courses does this is written the way I have tried in the ...
0
votes
0answers
92 views
1
vote
1answer
35 views