This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires Python 3.12+, IPython, rich | |
import datetime | |
import hashlib | |
import importlib | |
import inspect | |
import json | |
import logging | |
import os | |
import pkgutil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python 3.6 min | |
import json | |
import re | |
import argparse | |
# CONSTS | |
DEFAULT = 'default' | |
VERSION = 'version' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask_frozen import Freezer | |
from siteperso import app | |
freezer = Freezer(app) | |
if __name__ == '__main__': | |
freezer.freeze() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "base.html" %} | |
{% block body %} | |
<div class="container"> | |
<div class="text-zone presentation"> | |
<h1>Hello!</h1> | |
<p class="lead"> | |
I'm David, 28, French <a href="{{ url_for('consulting') }}">Freelancer</a> and <a href="{{ ext_urls['magnetiz'] }}" target="_blank">Founder</a>, living in Paris.<br> | |
I work as a Back-End Engineer using Python and Django.<br> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template | |
app = Flask(__name__) # create the application instance :) | |
app.config.from_object(__name__) # load config from this file | |
# External URLs | |
ext_urls = dict( | |
linked_in="https://www.linkedin.com/in/daviddahanepita", | |
medium="https://medium.com/@ddahan/latest", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_updated_time_or_datetime(time_or_datetime): | |
if time_or_datetime: | |
if is_naive(time_or_datetime): | |
return make_aware(time_or_datetime, timezone.utc) - timedelta(hours=2) | |
else: | |
return time_or_datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def email_verification(request, token): | |
# On vérifie la validité du token et raise une erreur si invalide | |
u = User.get_user_from_token(str_token=token) | |
# ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url(r'^email_verification/(?P<token>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$', views.email_verification, name='email_verification') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User(AbstractBaseUser, PermissionsMixin): | |
#... | |
private_token = UUIDField(blank=True, null=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@user_passes_test(User.is_owner) | |
def viewClients(request): | |
# .... |
NewerOlder