Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
I need some feedback on the README for my Django Base Site

I have a new draft of the README for my Django Base Site, and I would love some feedback. The goal is to encourage more people to use it. I'm biased of course, but I think it would help beginners and seasoned veteran jump-start any new project.

/r/django
https://redd.it/zyak8e
mission-commander needs proper UI

Instead of rockets, it controls Transmission clients. Specifically, it adds the RSS functionality. More about it on github:

https://github.com/jure965/mission-commander

Currently it only has built-in admin pages, but has otherwise worked for me flawlessly for about two months. It is a Django project with Celery and is dockerized for easy deployment and a no mess experience.

If you are willing to learn and/or exercise Django templates, you are welcome to contribute. Project is small - under 5 models, and all work is voluntary. CSS framework(bootstrap, tailwind, ...) at your discretion, if you want to use one. I'll try to support you in any way I can, by answering questions you may have and by commenting the pull requests. In general, the following pages are in todo, but not limited to: login, feeds, torrents, transmission clients.

/r/djangolearning
https://redd.it/zy5dk6
Deploying to Railway

So, I currently have my SECRET KEY and DEBUG in an env file and I’m using Python-decouple to implement them. However, Railway is crashing and it seems the only way I get an app deployed is by exposing my SECRET KEY. Is there a better way?

/r/django
https://redd.it/zyl0c0
How to change the passwords error messages

How do you customize the password error messages? More precisely, is there an error name for "password too common" or "password too short" like "unique" is an error name? Can I do some

self.fields["password1"].error_message = {"password_too_short": "password too short"}

kind of magic?

/r/django
https://redd.it/zym5ud
How to prevent access to a route ?

How to prevent access to a route unless it has been called from another route. I have created a login page that accepts only one user ( username and password of admin) and after the user credentials is correct, it redirects to another route called /display. But this /display route can be accessed just by typing inside the search bar of the browser. I want to prevent the access, unless it is redirected from the login page. I felt using flask_admin and flask_login was too complex. If there is another method please suggest thanks.

/r/flask
https://redd.it/zyd1nl
I want to add unit tests to my Django project but don't know where do i even start



Hey everyone,

I developped an app at my workplace (i'm not a developper officially) using Django, it allows users to login, view data, make comments on data X.

Since it is a quite simple CRUD app, i managed to make it work without any unit testing. I never did any unit tests in my small developper life (5 years).

Now they're asking me to add the option to send out emails containing data X.

I thought this feature would be a good use case for learning unit tests.

Where do i even start? Probably would have to start by something very simple to first get the hang of what unit testing is. Any roadmap to suggest?

I'm quite good at coding and getting stuff done using google (or OpenAI now...), but would like to become more of a real software developper and i know it starts with writing testable code.

Thanks guys.

/r/djangolearning
https://redd.it/zynykr
How to save a list inside my a SQL Database model ?

How can I save a list inside a database model ?

testlist = ["name1". "name2", "name3"]

class Listing(models.Model):
listing
price = models.CharField(maxlength=100)
listing
type = models.CharField(maxlength=100)
listing
list = models.?????

/r/djangolearning
https://redd.it/zyio95
Where am i going wrong

So im following [https://www.youtube.com/watch?v=sm1mokevMWk](https://www.youtube.com/watch?v=sm1mokevMWk) this tutorial and at 49:20 he heads towards the admin dashboard.

When i try the same thing i get a

main.models.ToDoList.DoesNotExist: ToDoList matching query does not exist.

On my cmd

Just to clarify this is my code in [views.py](https://views.py)

from django.shortcuts import render
from django.http import HttpResponse
from .models import ToDoList,Items
def index(response,id):
ls=ToDoList.objects.get(id=id)
item=ls.item_set.get(id=1)
return HttpResponse("<h1>%s</h1><br></br><p>%s</p>"%(ls.name,str(item.text)))

&#x200B;

/r/djangolearning
https://redd.it/zy0x35
OpenAI just rick rolled me...

https://imgur.com/a/cDLSnHw

Was tinkering around with how to write a python file to download a youtube video and was very interested to see what video it had suggested as a placeholder...

/r/Python
https://redd.it/zyyv9z
Handling relations using Django REST Framework ModelSerializer

Hi there, I have been working with DRF for a few years. I currently work as a lead developer at a small Canadian company with a very complex piece of Django stack that is responsible for a relatively large cashflow (we were recently acquire by a very large company). I often see developers jumping into Python/Django world and get very confused about how to use DRF ModelSerializer, and sometimes devs get scared away by the amount of unknown abstraction behind ModelSerializer, they choose to use Serializer instead and implement a lot of the functionality that is already provided by ModelSerializer. So I finally sat down over Christmas break here and wrote this tutorial over the last couple of days, I hope that it helps to explain how to use ModelSerializer to handle model relationships:

https://github.com/oscarychen/deep-dive-drf-model-serializer-relations

It is kind of a difficult read as it touches a lot of nitty gritty implementation details, any suggestion is welcome.

/r/django
https://redd.it/zyuskh
I learnt all the basics about python and had interest in learning about "AI development with python". and now I'm stuck cuz I don't know where to start. Can anyone give some advice to me ?



/r/Python
https://redd.it/zz1h3i
Hi, I have a problem. The thing is that I´m new using Django, and I tried to make a quiz. So far, I can show in the server the question, but not the options. I need to be able to show the options and I need something else: receive the answers and send feedback to the user. Here's my code.

https://redd.it/zzcncy
@pythondaily