Skip to content

Instantly share code, notes, and snippets.

View realnot's full-sized avatar
🏠
Working from home

Mauro Crociara realnot

🏠
Working from home
View GitHub Profile
@sreeragh-ar
sreeragh-ar / python_quick_tips.ipynb
Created June 23, 2021 14:07
Python_quick_tips.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@andreif
andreif / show_urls.py
Last active May 11, 2022 11:16
A command to show urls of a Django project
import sys
from django.core.management import BaseCommand
from django.urls import resolvers
def collect_urls(urls=None, namespace=None, prefix=None):
if urls is None:
urls = resolvers.get_resolver()
prefix = prefix or []
if isinstance(urls, resolvers.URLResolver):