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
# 5
# 6
# 7
# 8
# 9
# 10
Online Text Multiplayer RPG engine?

What would you use if you wanted to making something like Kingdom of Loathing , a browser-based rpg with light multiplayer interactions ?

/r/Python
https://redd.it/7fdkux
Push notifications in django

I want to use Firebase to send push notifications, and I see fcm django, but I dont find how to associate device with user.
Thanks.

/r/django
https://redd.it/7fgugj
[AF] Posted Indicator

So I have coded my own forum for my Python Flask site. Problem is I can't figure out how to do it so that I can have an indicator next to posts if the user has already posted in that post. I have a separate table for the thread (main post) and then the replies.

SELECT tid, fid, subject, prefix, forums_topics.username, datetime, lastpost, lastposter,
replies, closed, sticky, avatar FROM forums_topics,users WHERE
users.username=lastposter AND forums_topics.fid = ? ORDER BY sticky DESC,lastpost DESC

That is my currently SQLite statement to get the list of threads for the forum page.

Anyone know how I could modify the SQLite statement to solve the issue.

/r/flask
https://redd.it/7ffz41
Does anyone know of an open source DRF project which implements user registration really well? I'm struggling to find one that's more production hardened...



/r/django
https://redd.it/7fhsfr
Graphs/Charts on webpage

Hey is there a way to display graphs or charts on a webpage? I have dug around a little and the libraries I found seemed like the cost to use for production. I was wondering if I could use seaborne or something for them.

I’m trying to display metrics of my objects so like total counts and how maybe are stock and deployed. I would like my homepage be a dashboard.

/r/django
https://redd.it/7fk0x0
[AF]How to work with an API and routes

I'm trying to develop a REST API using Flask. I chose this framework since I like python to do common tasks, also Flask seems easier than Django.

The goal of developing a REST API is to later consume it from a webpage and from an android/iOS app (as you may see is a big personal project).

I'm having a hard time thinking of how the consumption of the api should be since I don't know anything about front nor backend.

Here goes my question:

Suppose I have this route - mydomain.com/api/1.0/tasks. This route is made to return a json with all the tasks. I was thinking of defining an html page with a button and when the button is pressed, the action of that button equals a route of the shape mydomain.com/tasks...this route internally calls the api, the api returns a json to the function inside that route. then that json is passed as an argument to a render_template('tasks.html',json) and finally that render_template is returned. Is that correct? Or maybe a frontend framework like angular/react is capable of handling and presenting a json?

I need a bit of guidance in how to desing the api to work with views.

If any of you need any further details dont hesitate to ask, I really need to work this out.

/r/flask
https://redd.it/7anx2j
Django template inclusion issue

Hi,

being lost how include a template without that annoying newline added.

For example, separated and generalized logic for generating attributes for a html tag:

# templates/widgets/attrs.html
{% for name, value in attrs.items %} {{ name }}="{{ value|stringformat:'s' }}"{% endfor %}


When included in a parent template,

# widgets/list_widget_item.html
<li{% include "widgets/attrs.html" %}>List Item Element</li>

django renders it with unwanted newline

<li class="my-li-class"
>List Item Element</li>


Although valid and handled properly by most browsers, I'd like to get expected result instead of that compromise.

I've tried enclose inclusion with `spaceless` tag, however it removes *all* whitespace characters including (optional) leading space, not only the newline.

Any better solution to this straight and trivial demand ?


/r/django
https://redd.it/7fnv8c
Django too complicated for someone like me?

I've been trying to create some sort of political quiz for a long, long while now.

I have little programming knowledge, although I've been using Python in not much depth for the past year.

My progress has been awfully slow, I haven't found the tutorials to be helpful at all and nobody else is really helping me in any depth... is it worth just giving up for now and returning to Django when I have more knowledge of Python?

All I've been trying to do is make a quiz, which has about 50 questions, all which have the options "Strongly Agree" to "Strongly Disagree" with a Neutral option. I wanted the result to be stored in some sort of database so they could be interpreted and a result be generated at the end.

I have gone from using two separate models like the Django tutorial have (Questions and Choices) to just one (Questions) that has the options hard coded into it... but I haven't been able to get those to show up anywhere (things jinja templating are completely lost on me)

/r/djangolearning
https://redd.it/7fesgx