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
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?

Use this thread to chat about and share Python resources!

/r/Python
https://redd.it/up4vg6
hey is there anny option to remove obj from table but not delete from DB?

for example i got start and stop button i want with the stop button that the obj removes from todays jobs. Anny functions ?

/r/django
https://redd.it/upge19
i want to Redirect to the same view after delete??

**so after deleting comment i can't back to detailviews of my comments , i need back with the pk of the post**

\#error

`Reverse for 'CommentsBack' not found. 'CommentsBack' is not a valid view function or pattern`



#views
# list all the comments of ever post l
class comment_back (DetailView):
model=Post
template_name='CommentsBack.html'

#delete comment by his primary key
def delete_comment(self,pk):
event=Comment.objects.get(pk=pk)
event.delete()  
return redirect('CommentBack')

​

#urls

path('mypost/<int:pk>/commentBack', comment_back.as_view(),name="commentBack"),
path('DeleteComment/<int:pk>/remove', views.delete_comment,name="delete_comment"),

/r/djangolearning
https://redd.it/uplkto
Hi all , weird one happening for me tonight . Started a new project and created my first few tables . When I created a super user via manage.py shell it won’t let me log in to /admin/

Any idea why it’s not allowing me in ?

/r/django
https://redd.it/upr3t4
Biometrics Enrollment in Django.

Please who has an idea on biometrics enrollment using Django? I am currently working on a web application that requires fingerprint capturing from users. The fingerprints are captured and saved to the database and users can also login through their username and their fingerprints.

Please I need your suggestions.

Thank you.

/r/djangolearning
https://redd.it/uph56b
Hey, I have question on how adding a click event to my plotly object in a dash app. Actually, I am trying to open the ensembl website by clicking on a scatter structure (see figure attached) inside my plotly figure.

/r/IPython
https://redd.it/n5doto
Sunday Daily Thread: What's everyone working on this week?

Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.

/r/Python
https://redd.it/uptmup
How do you name the project directory?

It is about convention so I can do whatever I want at the end of the day. But let me ask this question.

By "project directory" I mean the inner mysite/ directory in the official Django tutorial.

In the official tutorial, the outer directory and the inner directory have the same name and I find it kind of confusing.

So I named it "config". But something doesn't feel right.

And I still find it confusing because you can have other config files or directories when developing with Django such as setup.cfg and pre-commit-config.yaml etc...

I prefer "project_config". But the name's kinda long and as far as I know, nobody uses it.

Some people apparently prefer"project".

https://forum.djangoproject.com/t/project-naming-conventions/339

What do you think about the name "project_config"? Redundant?

And how do you name the project directory?

/r/django
https://redd.it/uq06st
I made a package that prints trees to the console

&#x200B;

https://preview.redd.it/ig0oabgn6lz81.jpg?width=469&format=pjpg&auto=webp&s=5d4114e527373799d18d77d193f1071f1c6c13c0

https://github.com/AharonSambol/PrettyPrintTree

I couldn't find any good way to print trees to the console... So I made one :)

It helps a ton with debugging!

/r/Python
https://redd.it/uq0bdo
Monday Daily Thread: Project ideas!

Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.

/r/Python
https://redd.it/uqixn0
Where to put things to be shared among different apps

I'm working on a personal project relating the backend for a point of sale app. I'd like to know the best approach for locating things like Models, Serializers and Views (among other things) that are not related to a specific app and are shared among all of them.

For example, my apps are:

* authentication (relating users)
* client
* quote
* sale

I added a new app called helper which for example has:

* A model module where a have a BaseModel with *created\_at* and *updated\_ad* fields from which most of my models on my apps inherit.
* A views module that has CRDViewSet and CRViewSet, which are Create Read Delete and Create Read ViewSets which inherit from GenericViewSet and the needed mixins, and are used on some views on the other apps.
* A validators module with functions that validate things like a positive value, not negative value, and acceptable future date, among other things which also are validations shared and used in different serializers on my apps.

Is it okay for this *helper* app to exist or is there a more recommended way to have these different structures which are shared among apps?

&#x200B;

Edit: Thanks for all your answers, I agree that core sounds a lot better

/r/django
https://redd.it/urddpe