Skip to content

Instantly share code, notes, and snippets.

Chelder cheldernunes

View GitHub Profile
cheldernunes /
Created Mar 11, 2019
Gerar SSH Key public
cd ~/.ssh
ssh-keygen -t rsa -b 4096 -C ""
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/
cheldernunes /
Created Oct 12, 2018
Django RegexValidator for phone numbers with ddd+number(8 or 9) digits
# brazil's code areas
phone_validator = RegexValidator(regex=r'^(1[1-9]|2[1-2,4,7,8]|3[1-5]|3[7-8]|4[1-9]'
message="Phone number must be entered in the format '99000000000'. "
"where 99(2 digits) is a brazil code area, and 000000000 is a number phone "
"with 8 or 9 digits.")
cheldernunes /
Created Oct 5, 2018
This gist show how remove add link in related fields in admin django. Replace field_name with your field.
class CustomAdmin(admin.ModelAdmin):
def formfield_for_dbfield(self, db_field, **kwargs):
formfield = super().formfield_for_dbfield(db_field, **kwargs)
if == "field_name":
formfield.widget.can_add_related = False
return formfield
You can’t perform that action at this time.