Skip to content

Instantly share code, notes, and snippets.

View matheuscas's full-sized avatar

Matheus Cardoso matheuscas

View GitHub Profile
@matheuscas
matheuscas / pylint-recursive.py
Last active October 10, 2016 18:33 — forked from gregorynicholas/pylint-recursive.py
Module that runs pylint on all python scripts found in a directory tree..
#! /usr/bin/env python
'''
Module that runs pylint on all python scripts found in a directory tree..
'''
import os
import re
import sys
total = 0.0
@matheuscas
matheuscas / views.py
Last active August 7, 2020 14:52 — forked from Diegow3b/views.py
Turning arround m2m_changed bug in admin from Django 1.8
'''
Obs1: m2m_changed never trigger the remove signal (pre_remove, post_remove) when deleted, so this ways you can force he do it
obs2: Since the pre_clear data will be removed anyways to new valuei n post_add add it again and when you fully remove data
the add events wont be trigger, so this solution will simule the exacly action the m2m_changed should do
'''
class OtherModel(model.Models)
pass
class MyModel(model.Models):
m2m_attribute = models.ManyToManyField(OtherModel,related_name='other_model', blank=True)