Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "jinja2"
-
Dear PyCharm,
When you decide to change the default templating language from Django to Jinja2, please tell me.
You owe me for psychiatrist bills2 -
Jinja2 is so awful compared to simple and elegant erb, but you can't go over python whitespace limitations.
-
I must assume that whoever designed jinja2 was either on crack, or hadn’t used template systems before. This thing is too fucking complicated, and doesn’t make sense. From their docs:
“Jinja2 supports dynamic inheritance and does not distinguish between parent and child template as long as no extends tag is visited. While this leads to the surprising behavior that everything before the first extends tag including whitespace is printed out instead of being ignored, it can be used for a neat trick.”
My response: “I don’t give a fuck!! I need this fucking website to be fucking done already! I pass data into a fucking template engine, and the engine applies my fucking markdown!! This is bullshit!! Why am I still trying to understand your fucking nonsense?!? AGGJCDJVFD&@!?&@$?)@&!SHHHVBSHK!!!!!!”
*desk flip*
Fuck you to hell you jinja fucker3 -
Got a bit distracted today. Instead of doing what I've wanted, I created the most comfortable way to make a site ever. I'm serious. It beats all those static site generators.
Hmm, could even make a static site generator of this one. Won't do, no benefit.
It's by using markdown and it has support for syntax highlighting of many languages. A website could be literary:
# My blog
## some code
```c
printf("This is my C code");
```.
And you already have something decent. See the 'Get started' section. You have a site running in no time. See also the Python database example at the bottom, it shows you how to use the internal sqlite3 database in your 'static' site and how to create a visitor counter!
Sky's the limit.
I came up with the idea by teaching my next door neighbor HTML and that was succesfull. She is able to navigate trough files and folders and edit a file like most people. Then I realized, if it was markdown, it would be really user friendly for anyone to use. To create a decent site, you only need to make a stylesheet for someone. By using # ## ### #### headings, it will always be in your designed style.
People won't fuck your site up like they do with WYSIWYG normally.
The concept is so simple, I only see advantages and it could be used for small and big content sites. It doesn't do caching on purpose, overkill and it's more comfortable this way.
Here is project link: https://molodetz.nl/retoor/dreamii1 -
I don’t want to have anything to do with your shitty templating language. I hate Jinja2. Just keep it away from me.
-
Someone answer this question.
I'm stuck on this.
I've tried almost everything that's possible
https://stackoverflow.com/questions...4 -
I can't count likes form my database for an specific post. I made a function that will count all the like by "post.id". It shows the like on the web page when I clicked on like button and it disappears when I refresh the browser. but likes are still remaining in the database but it won't appear on the webpage.
Here are the flask code:
def like_count(post_id):
if request.form.get('like') != None:
if (Like.query.filter_by(post_id=post_id).all())==[]:
return 0
else:
return Like.query.filter_by(post_id=post_id).count()
else:
return 0
def dislike_count(post_id):
if request.form.get('dislike') != None:
if (Dislike.query.filter_by(post_id=post_id).all())==[]:
return 0
else:
return Dislike.query.filter_by(post_id=post_id).count()
else:
return 0
Here are the html code:
<!--dislike-->
<form method="POST" action="">
<input name="dislike" value="1" class="input-style" >
<input value="{{post.id}}" name="post_id" class="input-style">
<button class="fas fa-thumbs-down" class="like-button" >
<div class="like-count" >
{{dislike_count(post.id)}}
</div>
</button>
</form>
<!--like-->
<form method="POST" action="" >
<input name="like" value="1" class="input-style" >
<input name="post_id" value="{{post.id}}" class="input-style" >
<button class="fas fa-thumbs-up" class="like-button" >
<div class="like-count" >
{{like_count(post.id)}}
</div>
</button>
</form>8 -
Is it just me, or are the Jinja2 docs shit?
Won't tell me how to sort my JSON file via a JSON variable. Fucking irritating.