Skip to content

Instantly share code, notes, and snippets.

View ZeroCoolHacker's full-sized avatar
🎖️
Code Lover

Zero Cool ZeroCoolHacker

🎖️
Code Lover
View GitHub Profile
@ZeroCoolHacker
ZeroCoolHacker / foo.py
Created October 23, 2020 19:54 — forked from Grokzen/Symmetrical ManyToMany Filter Horizontal in Django Admin.py
Symmetrical ManyToMany Filter Horizontal in Django Admin
# Based on post from: https://snipt.net/chrisdpratt/symmetrical-manytomany-filter-horizontal-in-django-admin/#L-26
# Only reposting to avoid loosing it.
"""
When adding a many-to-many (m2m) relationship in Django, you can use a nice filter-style multiple select widget to manage entries. However, Django only lets you edit the m2m relationship this way on the forward model. The only built-in method in Django to edit the reverse relationship in the admin is through an InlineModelAdmin.
Below is an example of how to create a filtered multiple select for the reverse relationship, so that editing entries is as easy as in the forward direction.
"""
### pizza/models.py ###
@ZeroCoolHacker
ZeroCoolHacker / meta-tags.md
Created May 21, 2019 12:40 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@ZeroCoolHacker
ZeroCoolHacker / adding-to-user-admin-form.py
Created September 27, 2018 17:40 — forked from riklomas/adding-to-user-admin-form.py
How to add a field to the Django Admin Add User form using UserCreationForm. Add this to a admin.py and alter to whatever fields you'd like
# How to add a field to the Django Admin Add User form
# using UserCreationForm. Add this to a admin.py and alter
# to whatever fields you'd like
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
Verifying my Blockstack ID is secured with the address 1HR3zk5qa8evQaGzPcHEJnxnZAErBvn5bn https://explorer.blockstack.org/address/1HR3zk5qa8evQaGzPcHEJnxnZAErBvn5bn
@ZeroCoolHacker
ZeroCoolHacker / index.html
Last active December 5, 2017 20:46
Tribute Page
<div class="container">
<div class="jumbotron">
<h1 class="text-primary text-center">Leader Imran Khan</h1>
<h2 class="text-center"><em>Who saved 193 million people</em></h2>
<div class="thumbnail">
<img src="http://p.imgci.com/db/PICTURES/CMS/246700/246783.jpg" alt="Imran Khan shaking hands with the Queen.">
<div class="caption">
<p class="text-center">Imran Khan,the one shaking hands with queen, is introduced to the Queen by Intikhab Alam, Lord's, 1971</p>
</div>
</div><!-- End of thumbnail -->