Urgent help
Im trying to make a website using Flask. This website has a linked database with SQLlite. Im trying to make an attendance feature with the for the website. The website will be used to record people attending a club. Ideally I would like the user to be able to see a list of checkboxes and just be able to tick who has attended the meeting. Im struggling to work out how to get my user data (store in my database) into my html file to make the attendance register. Any help would be greatly appreciated
/r/flask
https://redd.it/1isks26
Im trying to make a website using Flask. This website has a linked database with SQLlite. Im trying to make an attendance feature with the for the website. The website will be used to record people attending a club. Ideally I would like the user to be able to see a list of checkboxes and just be able to tick who has attended the meeting. Im struggling to work out how to get my user data (store in my database) into my html file to make the attendance register. Any help would be greatly appreciated
/r/flask
https://redd.it/1isks26
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Issue with Deploying Heavy Flask App on AWS Lightsail Containers
Hi everyone,
I’ve built a Flask-based web app for backtesting and optimising trading strategies using ML. It’s quite CPU- and memory-intensive, as it loads large datasets, runs calculations, and outputs results.
My Docker setup looks like this:
🔹 App container (Flask)
🔹 Redis container (for caching & Celery tasks)
🔹 Celery container (for background task execution)
🔹 Nginx container (reverse proxy)
The app runs fine on a standard server, but I’ve struggled to deploy it using AWS Lightsail containers. The main issue is that the containers randomly shut down, and logs don’t provide any useful error messages. Even when I scale up resources (CPU/RAM), the issue persists.
I’d love to hear from anyone who has experienced similar issues or has suggestions on:
1. Debugging container shutdowns on Lightsail (how to get better logs?)
2. Optimising Docker deployments for memory-heavy apps
3. Alternative hosting solutions if Lightsail isn’t a good fit
Any insights would be super helpful! Thanks in advance. 🚀
Tech Stack: Python | Flask | Celery | Redis | Docker | Lightsail
/r/flask
https://redd.it/1isccnk
Hi everyone,
I’ve built a Flask-based web app for backtesting and optimising trading strategies using ML. It’s quite CPU- and memory-intensive, as it loads large datasets, runs calculations, and outputs results.
My Docker setup looks like this:
🔹 App container (Flask)
🔹 Redis container (for caching & Celery tasks)
🔹 Celery container (for background task execution)
🔹 Nginx container (reverse proxy)
The app runs fine on a standard server, but I’ve struggled to deploy it using AWS Lightsail containers. The main issue is that the containers randomly shut down, and logs don’t provide any useful error messages. Even when I scale up resources (CPU/RAM), the issue persists.
I’d love to hear from anyone who has experienced similar issues or has suggestions on:
1. Debugging container shutdowns on Lightsail (how to get better logs?)
2. Optimising Docker deployments for memory-heavy apps
3. Alternative hosting solutions if Lightsail isn’t a good fit
Any insights would be super helpful! Thanks in advance. 🚀
Tech Stack: Python | Flask | Celery | Redis | Docker | Lightsail
/r/flask
https://redd.it/1isccnk
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Wednesday Daily Thread: Beginner questions
# Weekly Thread: Beginner Questions 🐍
Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.
## How it Works:
1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.
## Guidelines:
This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).
## Recommended Resources:
If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.
## Example Questions:
1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?
Let's help each other learn Python! 🌟
/r/Python
https://redd.it/1isrcry
# Weekly Thread: Beginner Questions 🐍
Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.
## How it Works:
1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.
## Guidelines:
This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).
## Recommended Resources:
If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.
## Example Questions:
1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?
Let's help each other learn Python! 🌟
/r/Python
https://redd.it/1isrcry
Discord
Join the Python Discord Server!
We're a large community focused around the Python programming language. We believe that anyone can learn to code. | 412982 members
Is UV package manager taking over?
Hi!
I am a devops engineer and notice developers talking about uv package manager. I used it today for the first time and loved it. It seems like everyone is talking to agrees. Does anyone have and cons for us package manager?
/r/Python
https://redd.it/1isv37n
Hi!
I am a devops engineer and notice developers talking about uv package manager. I used it today for the first time and loved it. It seems like everyone is talking to agrees. Does anyone have and cons for us package manager?
/r/Python
https://redd.it/1isv37n
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
New version FastAPI Guard + Redis - A FastAPI extension to secure your APIs
Original post
I'm happy to tell you I've just released a new version (1.0.0) of FastAPI Guard - this time with Redis Integration and some other upgrades :)
Take a look at the docs & repo:
Documentation: rennf93.github.io/fastapi-guard/
GitHub repo: github.com/rennf93/fastapi-guard
# Important note
The new version allows you to persist ip bans, rate limits, and more, across workers of a single application and/or other applications. Now you can have a single source of truth thanks to this integration of Redis into FastAPI Guard.
If you've already came across or read the previous post, you might want to skip the following text as it's mostly the same.
---
What is it?
FastAPI Guard is a security middleware for FastAPI that provides:
- Redis Integration (new!)
- IP whitelisting/blacklisting
- Rate limiting & automatic IP banning
- Penetration attempt detection
- Cloud provider IP blocking
- IP geolocation via IPInfo.io
- Custom security logging
- CORS configuration helpers
It's licensed under MIT and integrates seamlessly with FastAPI applications.
Comparison to alternatives:
-
-
-
-
Key differentiators:
- Combines multiple security layers in single middleware
- Automatic IP banning based on suspicious activity
- Built-in cloud
/r/Python
https://redd.it/1isqf8y
Original post
I'm happy to tell you I've just released a new version (1.0.0) of FastAPI Guard - this time with Redis Integration and some other upgrades :)
Take a look at the docs & repo:
Documentation: rennf93.github.io/fastapi-guard/
GitHub repo: github.com/rennf93/fastapi-guard
# Important note
The new version allows you to persist ip bans, rate limits, and more, across workers of a single application and/or other applications. Now you can have a single source of truth thanks to this integration of Redis into FastAPI Guard.
If you've already came across or read the previous post, you might want to skip the following text as it's mostly the same.
---
What is it?
FastAPI Guard is a security middleware for FastAPI that provides:
- Redis Integration (new!)
- IP whitelisting/blacklisting
- Rate limiting & automatic IP banning
- Penetration attempt detection
- Cloud provider IP blocking
- IP geolocation via IPInfo.io
- Custom security logging
- CORS configuration helpers
It's licensed under MIT and integrates seamlessly with FastAPI applications.
Comparison to alternatives:
-
fastapi-security: Focuses more on authentication, while FastAPI Guard provides broader network-layer protection-
slowapi: Handles rate limiting but lacks IP analysis/geolocation features-
fastapi-limiter: Pure rate limiting without security features-
fastapi-auth: Authentication-focused without IP managementKey differentiators:
- Combines multiple security layers in single middleware
- Automatic IP banning based on suspicious activity
- Built-in cloud
/r/Python
https://redd.it/1isqf8y
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
open source code for translating Chinese in the image into Korean?
I found the function to remove text from an image through a web search. With the lama cleaner, you can use the image inpainting function reliably and quickly, but I'm asking because I want to add additional features. You can translate text and type the text directly, or you can automatically cover the image with a translated text just like the texture of the background. And I wish I could edit the text myself. Please give me some sources or address that I can recommend.
# 🔍 Image Text Editing and Translation Query
I discovered an image text removal function through web searching ✨. While the Lama Cleaner's image inpainting function works reliably and quickly, I'm looking to add some additional features 🛠️:
1. 🌐 Text translation capabilities:
📝 Direct text input functionality
🎨 Automatic background-matching text overlay with translations
2. ✏️ Custom text editing features:
🔧 Ability to manually edit and customize text
🎯 Personal text modification options
I would appreciate recommendations for relevant resources or references that could help implement these features 📚.
/r/flask
https://redd.it/1iswknk
I found the function to remove text from an image through a web search. With the lama cleaner, you can use the image inpainting function reliably and quickly, but I'm asking because I want to add additional features. You can translate text and type the text directly, or you can automatically cover the image with a translated text just like the texture of the background. And I wish I could edit the text myself. Please give me some sources or address that I can recommend.
# 🔍 Image Text Editing and Translation Query
I discovered an image text removal function through web searching ✨. While the Lama Cleaner's image inpainting function works reliably and quickly, I'm looking to add some additional features 🛠️:
1. 🌐 Text translation capabilities:
📝 Direct text input functionality
🎨 Automatic background-matching text overlay with translations
2. ✏️ Custom text editing features:
🔧 Ability to manually edit and customize text
🎯 Personal text modification options
I would appreciate recommendations for relevant resources or references that could help implement these features 📚.
/r/flask
https://redd.it/1iswknk
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Have you needed to reach for Django?
I’m pretty new to web development with Python and got started with Flask. I like working with it a lot; its lack of how opinionated it is and less moving parts makes spinning something up really easy for the simple things I’ve built with it, though I could see how less structure may even be seen as a downside depending on how you look at it.
But recently I’m seeing signs pointing me to build websites with Django. Updates get released more frequently, more people use it, there’s good ORM/database support, authentication, a robust admin console… but that’s kind of it. In some building with it how opinionated it is especially compared to Flask has bogged me down in terms of productivity. Admittedly these are fairly simple projects I’ve built so far. I’m finding myself working against it and learning how to use it rather than actually using it. On the other hand building with Flask seems to be more productive since I find building and learning in-parallel to be much easier than in Django.
Right now I’m trying to build something similar to Craigslist but with a twist as mostly a learning exercise but also to see if it can take
/r/flask
https://redd.it/1ir4toh
I’m pretty new to web development with Python and got started with Flask. I like working with it a lot; its lack of how opinionated it is and less moving parts makes spinning something up really easy for the simple things I’ve built with it, though I could see how less structure may even be seen as a downside depending on how you look at it.
But recently I’m seeing signs pointing me to build websites with Django. Updates get released more frequently, more people use it, there’s good ORM/database support, authentication, a robust admin console… but that’s kind of it. In some building with it how opinionated it is especially compared to Flask has bogged me down in terms of productivity. Admittedly these are fairly simple projects I’ve built so far. I’m finding myself working against it and learning how to use it rather than actually using it. On the other hand building with Flask seems to be more productive since I find building and learning in-parallel to be much easier than in Django.
Right now I’m trying to build something similar to Craigslist but with a twist as mostly a learning exercise but also to see if it can take
/r/flask
https://redd.it/1ir4toh
Reddit
[deleted by user] : r/flask
91K subscribers in the flask community. Flask is a Python micro-framework for web development. Flask is easy to get started with and a great way to build websites and web applications.
programming buddy
anybody wanna collab on projects and things of that nature? i literally dont know anybody who codes in real life its just me.
/r/Python
https://redd.it/1isw93f
anybody wanna collab on projects and things of that nature? i literally dont know anybody who codes in real life its just me.
/r/Python
https://redd.it/1isw93f
Reddit
From the Python community on Reddit: programming buddy
Posted by AMIRIASPIRATIONS48 - 8 votes and 14 comments
R The Curse of Depth in LLMs: Why Are Deep Layers Less Effective?
Recent research is shedding light on an unexpected problem in modern large language models, the deeper layers aren’t pulling their weight.
A recent paper, "The Curse of Depth in Large Language Models", highlights a critical issue:
\- Deep layers in LLMs contribute significantly less to learning than earlier ones.
\- Many of these layers can be pruned without serious performance loss, raising questions about training efficiency.
\- The culprit? Pre-Layer Normalization (Pre-LN), which causes output variance to explode in deeper layers, making them act almost like identity functions.
\- A simple fix? LayerNorm Scaling, which controls this variance and improves training efficiency.
This has major implications for LLM architecture, training efficiency, and scaling laws. If half the layers in models like LLaMA, Mistral, and DeepSeek aren’t contributing effectively, how much computational waste are we dealing with?
Key questions for discussion:
1️) Should we be rethinking deep-layer training strategies to improve efficiency?
2️) Does this impact the assumption that deeper = better in transformer architectures?
3️) Could insights from this paper help with LLM compression, fine-tuning, or distillation techniques?
Paper link: arXiv preprint: 2502.05795v1
Let’s discuss—what are your thoughts on the Curse of Depth?
/r/MachineLearning
https://redd.it/1isu1nn
Recent research is shedding light on an unexpected problem in modern large language models, the deeper layers aren’t pulling their weight.
A recent paper, "The Curse of Depth in Large Language Models", highlights a critical issue:
\- Deep layers in LLMs contribute significantly less to learning than earlier ones.
\- Many of these layers can be pruned without serious performance loss, raising questions about training efficiency.
\- The culprit? Pre-Layer Normalization (Pre-LN), which causes output variance to explode in deeper layers, making them act almost like identity functions.
\- A simple fix? LayerNorm Scaling, which controls this variance and improves training efficiency.
This has major implications for LLM architecture, training efficiency, and scaling laws. If half the layers in models like LLaMA, Mistral, and DeepSeek aren’t contributing effectively, how much computational waste are we dealing with?
Key questions for discussion:
1️) Should we be rethinking deep-layer training strategies to improve efficiency?
2️) Does this impact the assumption that deeper = better in transformer architectures?
3️) Could insights from this paper help with LLM compression, fine-tuning, or distillation techniques?
Paper link: arXiv preprint: 2502.05795v1
Let’s discuss—what are your thoughts on the Curse of Depth?
/r/MachineLearning
https://redd.it/1isu1nn
arXiv.org
The Curse of Depth in Large Language Models
In this paper, we introduce the Curse of Depth, a concept that highlights, explains, and addresses the recent observation in modern Large Language Models (LLMs) where nearly half of the layers are...
React-native Expo Fetch, Network request failed. On android Flask Api
# Problem
I have a React Native Expo application where I successfully call my Node.js API using my local IP. The API works both in the emulator and on my physical Android device. However, when I try to call my Flask API, I get a Network Request Failed error.
I am running my Flask app on my local machine (
# Flask API (Python)
Here’s my Flask app, which is a simple speech transcription API. It receives an audio file in base64 format, decodes it, and transcribes it using
from flask import Flask, request, jsonify
import base64
import tempfile
import speechrecognition as sr
from pydub import AudioSegment
from io import BytesIO
from flaskcors import CORS
import logging
app = Flask(name)
CORS(app, resources={r"/": {"origins": ""}}) # Allow all CORS requests
logging.basicConfig(level=logging.DEBUG)
def transcribeaudio(audiobase64):
try:
/r/flask
https://redd.it/1it221j
# Problem
I have a React Native Expo application where I successfully call my Node.js API using my local IP. The API works both in the emulator and on my physical Android device. However, when I try to call my Flask API, I get a Network Request Failed error.
I am running my Flask app on my local machine (
http://192.168.x.x:5000), and my physical Android device is connected to the same WiFi network.# Flask API (Python)
Here’s my Flask app, which is a simple speech transcription API. It receives an audio file in base64 format, decodes it, and transcribes it using
speech_recognition.from flask import Flask, request, jsonify
import base64
import tempfile
import speechrecognition as sr
from pydub import AudioSegment
from io import BytesIO
from flaskcors import CORS
import logging
app = Flask(name)
CORS(app, resources={r"/": {"origins": ""}}) # Allow all CORS requests
logging.basicConfig(level=logging.DEBUG)
def transcribeaudio(audiobase64):
try:
/r/flask
https://redd.it/1it221j
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
logging.getLevelName(): Are you serious?
I was looking for a function that would return the numerical value of a loglevel given as text. But I found only the reverse function per the documentation:
>logging.getLevelName(level) Returns the textual or numeric representation of logging level level.
That's exactly the reverse of what I need. But wait, there's more:
>The level parameter also accepts a string representation of the level such as ‘INFO’. In such cases, this functions returns the corresponding numeric value of the level.
So a function that maps integers to strings, with a name that clearly implies that it returns strings, also can map strings to integers if you pass in a string. A function whose return type depends on the input type, neat!
OK, so what happens when you pass in a value that has no number / name associated with it? Surely the function will return zero or raise a KeyError. But no:
>If no matching numeric or string value is passed in, the string ‘Level %s’ % level is returned.
Fantastic! If I pass a string into a function called "get..Name()" it will return an integer on success and a string on failure!
But somebody, at some point, a sane person noticed that this is a mess:
>Changed in version 3.4:
/r/Python
https://redd.it/1it29oi
I was looking for a function that would return the numerical value of a loglevel given as text. But I found only the reverse function per the documentation:
>logging.getLevelName(level) Returns the textual or numeric representation of logging level level.
That's exactly the reverse of what I need. But wait, there's more:
>The level parameter also accepts a string representation of the level such as ‘INFO’. In such cases, this functions returns the corresponding numeric value of the level.
So a function that maps integers to strings, with a name that clearly implies that it returns strings, also can map strings to integers if you pass in a string. A function whose return type depends on the input type, neat!
OK, so what happens when you pass in a value that has no number / name associated with it? Surely the function will return zero or raise a KeyError. But no:
>If no matching numeric or string value is passed in, the string ‘Level %s’ % level is returned.
Fantastic! If I pass a string into a function called "get..Name()" it will return an integer on success and a string on failure!
But somebody, at some point, a sane person noticed that this is a mess:
>Changed in version 3.4:
/r/Python
https://redd.it/1it29oi
Python documentation
logging — Logging facility for Python
Source code: Lib/logging/__init__.py Important: This page contains the API reference information. For tutorial information and discussion of more advanced topics, see Basic Tutorial, Advanced Tutor...
What’s a Django Package That Doesn’t Exist Yet, But You Wish It Did?
Hey fellow Django devs,
I’ve been thinking a lot about how powerful Django is, but sometimes there’s something missing that could make our lives a whole lot easier.
So I wanted to ask:
What’s a Django package you wish existed, but doesn’t yet?
It could be anything—something that solves a common problem or just makes development smoother. No matter how big or small, if you could create the perfect Django package to fill a gap in the ecosystem, what would it be?
/r/django
https://redd.it/1it4z6o
Hey fellow Django devs,
I’ve been thinking a lot about how powerful Django is, but sometimes there’s something missing that could make our lives a whole lot easier.
So I wanted to ask:
What’s a Django package you wish existed, but doesn’t yet?
It could be anything—something that solves a common problem or just makes development smoother. No matter how big or small, if you could create the perfect Django package to fill a gap in the ecosystem, what would it be?
/r/django
https://redd.it/1it4z6o
Reddit
From the django community on Reddit
Explore this post and more from the django community
What’s wrong with a classic server-side rendered (SSR) multi-page application (MPA) for most web apps? What’s so appealing about HTMX in early stages of development?
I recently built a web app with Django and used only a tiny bit of Alpine.js (less than 100 lines of JavaScript, in total). At first, I was excited about giving HTMX a try and adding it to the project, but the need never came. The UX feels good despite a full-page load on any navigation or form submission.
This makes me view HTMX as a nice-to-have thing or an optimization, so I’m a bit confused as to why people choose to use it so early in development.
In terms of UX, the experience HTMX provides is closer to a client-side rendered (CSR) web app than it is to a classic MPA SSR web app, so there is some sense in using HTMX if one wants to keep the UX.
As a user of the web (and a software engineer), I don’t care even a little about whether a web app is using CSR or SSR as long as it’s working and stable. In fact, in my experience, there’s a higher chance for me to have a worse UX when using a CSR web app, so I might even prefer classic SSR apps.
Obviously, there are valid use cases for various tools and technologies,
/r/django
https://redd.it/1it6f8b
I recently built a web app with Django and used only a tiny bit of Alpine.js (less than 100 lines of JavaScript, in total). At first, I was excited about giving HTMX a try and adding it to the project, but the need never came. The UX feels good despite a full-page load on any navigation or form submission.
This makes me view HTMX as a nice-to-have thing or an optimization, so I’m a bit confused as to why people choose to use it so early in development.
In terms of UX, the experience HTMX provides is closer to a client-side rendered (CSR) web app than it is to a classic MPA SSR web app, so there is some sense in using HTMX if one wants to keep the UX.
As a user of the web (and a software engineer), I don’t care even a little about whether a web app is using CSR or SSR as long as it’s working and stable. In fact, in my experience, there’s a higher chance for me to have a worse UX when using a CSR web app, so I might even prefer classic SSR apps.
Obviously, there are valid use cases for various tools and technologies,
/r/django
https://redd.it/1it6f8b
Reddit
From the django community on Reddit
Explore this post and more from the django community
D What is the future of retrieval augmented generation?
RAG is suspiciously inelegant. Something about using traditional IR techniques to fetch context for a model feels.. early-stage. It reminds me of how Netflix had to mail DVDs before the internet was good enough for streaming.
I just can’t imagine LLMs working with databases this way in the future. Why not do retrieval during inference, instead of before? E.g. if the database was embedded directly in the KV cache, then retrieval could be learned via gradient descent just like everything else. This at least seems more elegant to me than using (low-precision) embedding search to gather and stuff chunks of context into a prompt.
And FWIW I don’t think long context models are the future, either. There’s the lost-in-the-middle effect, and the risk of context pollution, where irrelevant context will degrade performance even if all the correct context is also present. Reasoning performance also degrades as more context is added.
Regardless of what the future looks like, my sense is that RAG will become obsolete in a few years. What do y'all think?
EDIT: DeepMind's RETRO and Self-RAG are some example implementations of learned retrieval that may be interesting.
/r/MachineLearning
https://redd.it/1itl38x
RAG is suspiciously inelegant. Something about using traditional IR techniques to fetch context for a model feels.. early-stage. It reminds me of how Netflix had to mail DVDs before the internet was good enough for streaming.
I just can’t imagine LLMs working with databases this way in the future. Why not do retrieval during inference, instead of before? E.g. if the database was embedded directly in the KV cache, then retrieval could be learned via gradient descent just like everything else. This at least seems more elegant to me than using (low-precision) embedding search to gather and stuff chunks of context into a prompt.
And FWIW I don’t think long context models are the future, either. There’s the lost-in-the-middle effect, and the risk of context pollution, where irrelevant context will degrade performance even if all the correct context is also present. Reasoning performance also degrades as more context is added.
Regardless of what the future looks like, my sense is that RAG will become obsolete in a few years. What do y'all think?
EDIT: DeepMind's RETRO and Self-RAG are some example implementations of learned retrieval that may be interesting.
/r/MachineLearning
https://redd.it/1itl38x
About using Django choices with Pydantic
I usually use pydantic in my Django program. I have always been troubled by the inability to apply Django choices to pydantic, so I wrote a
Defining my
https://melodious-condor-d48.notion.site/django-choices-1a061f9ffe6280ff9eabc172cb852cd8?pvs=4
Use it in model:
from django.db import models
from .choices import Choices, ChoiceField
class DataScore(Choices):
INCORRECT = ChoiceField(value=-1, label="错误")
UNKNOWN = ChoiceField(value=0, label="未知")
CORRECT = ChoiceField(value=1, label="正确")
class Data(models.Model):
# ... Some content is omitted
score = models.IntegerField(default=DataScore.UNKNOWN.value,
choices=DataScore.choices,
/r/django
https://redd.it/1itnjfu
I usually use pydantic in my Django program. I have always been troubled by the inability to apply Django choices to pydantic, so I wrote a
Choices class for my Django program. I hope you can help me see if this is a good way to do it, or if there is a more convenient way to achieve the same effect.Defining my
Choices class: https://melodious-condor-d48.notion.site/django-choices-1a061f9ffe6280ff9eabc172cb852cd8?pvs=4
Use it in model:
from django.db import models
from .choices import Choices, ChoiceField
class DataScore(Choices):
INCORRECT = ChoiceField(value=-1, label="错误")
UNKNOWN = ChoiceField(value=0, label="未知")
CORRECT = ChoiceField(value=1, label="正确")
class Data(models.Model):
# ... Some content is omitted
score = models.IntegerField(default=DataScore.UNKNOWN.value,
choices=DataScore.choices,
/r/django
https://redd.it/1itnjfu
tree olive's Notion on Notion
django choices | Notion
class ChoiceField:
def __init__(self, value, label):
self.value = value
self.label = label
def __eq__(self, other):
if isinstance(other, Field):
return self.value == other.value
return self.value == other…
def __init__(self, value, label):
self.value = value
self.label = label
def __eq__(self, other):
if isinstance(other, Field):
return self.value == other.value
return self.value == other…
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
# Weekly Thread: Professional Use, Jobs, and Education 🏢
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! 🌟
/r/Python
https://redd.it/1itkpfl
# Weekly Thread: Professional Use, Jobs, and Education 🏢
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! 🌟
/r/Python
https://redd.it/1itkpfl
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Happy Birthday, Python! 🎉🐍
Guido van Rossum began working on Python language in the late 1980s as a successor to the ABC programming language. The first version, Python 0.9.0, was released on this day, February 20, 1991.
/r/Python
https://redd.it/1itu5mn
Guido van Rossum began working on Python language in the late 1980s as a successor to the ABC programming language. The first version, Python 0.9.0, was released on this day, February 20, 1991.
/r/Python
https://redd.it/1itu5mn
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
My Ever-Expanding Python & Django Notes
Hey everyone! 👋
I wanted to share a project I've been working on: **Code-Memo** – a personal collection of coding notes. This is NOT a structured learning resource or a tutorial site but more of a living reference where I document everything I know (and continue to learn) about Python, Django, Linux, AWS, and more.
Some pages:
📌 **Python Notes**
📌 **Django Notes**
The goal is simple: collect knowledge, organize it, and keep expanding. It will never be "finished" because I’m always adding new things as I go. If you're a Python/Django developer, you might find something useful in there—or even better, you might have suggestions for things to add!
Would love to hear your thoughts.
/r/django
https://redd.it/1itzskt
Hey everyone! 👋
I wanted to share a project I've been working on: **Code-Memo** – a personal collection of coding notes. This is NOT a structured learning resource or a tutorial site but more of a living reference where I document everything I know (and continue to learn) about Python, Django, Linux, AWS, and more.
Some pages:
📌 **Python Notes**
📌 **Django Notes**
The goal is simple: collect knowledge, organize it, and keep expanding. It will never be "finished" because I’m always adding new things as I go. If you're a Python/Django developer, you might find something useful in there—or even better, you might have suggestions for things to add!
Would love to hear your thoughts.
/r/django
https://redd.it/1itzskt
How to simply add a blog, without a giant framework?
Does anyone know of a lib I can use to do the following:
1. I have an existing Django project
2. I want to write blog posts as markdown, put them in a folder
3. Django publishes them automatically, reading those files
Thanks
/r/django
https://redd.it/1ittqo2
Does anyone know of a lib I can use to do the following:
1. I have an existing Django project
2. I want to write blog posts as markdown, put them in a folder
3. Django publishes them automatically, reading those files
Thanks
/r/django
https://redd.it/1ittqo2
Reddit
From the django community on Reddit
Explore this post and more from the django community