In Django forms, you can either use exclude
or fields
to list a set of fields to exclude or include on the ModelForm
.
I prefer to use fields
to explicitly include fields on a form because it's easy to add fields to a model without thinking through it's use on a form somewhere in your project. However, if you are adding a field for the purpose of adding it to a form you'll have the form in mind so explicitly adding the field to the fields
list will not be forgotten about.
So far we have been teaching him:
He has all of these commands down somewhat. Of course being 14 weeks old he is still easily distracted. He is probably best at Sit and Leave It. Come works best if he thinks you are about to play with him or he isn't interested in something else, like a leaf.
I was using the axios
library this morning to do some simple AJAX requests and was hitting an issue with the CSRF token header and cookie name being different in that library than what my server expects.
I figured out how to override them by doing the following in the module where I am using axios
:
Caffeine offsets health damage from stress! Oh boy oh boy oh boy! http://t.co/SmusQLT3H1
— Marc Andreessen (@pmarca) June 18, 2015
The Pfunky Griddle was suggested by Nate West as a place with GF bread for sandwiches and GF pancake batter.
Excited about hitting two new PRs this week after only being back at working out after being off for 3-4 months due to shoulder surgery.
On Monday, I pulled 505 pounds for a new deadlift 1 rep max.
Last night, I cleaned 275 pounds for a new 1 rep max.
A topic list has been started where you can add things you'd like to see covered and/or vote for existing ones.
There is a video circulating on social media of two young black kids being filmed by their father holding up their report cards littered with F's from a school in Memphis. He is showing the world the humiliating haircuts he gave them to teach them a lesson.
I have already seen this video a few times from a few different friends so didn't think it worth propagating by sharing.
I did want to just say that I think this father is extremely misguided to think that coercion via humiliation as a sound and loving parenting technique. Whether he realizes it or not, this is a form of abuse that will only have lasting negative consequences on his children.
I wonder how much time this dad has spent helping his children with school work? When is the last time he helped his sons set goals and achieve them and then express how proud he is of them? Son need to know their father both loves and is proud of them. As they get older they yearn to know they make their father proud dk far more than even how much he loves them.
This type of abuse breaks my heart and I hate to see it spread through social media as if this father is some sort of hero.
Dads: don't be lazy. Anyone can make a video. Take time instead to build up your children instead of tear them down. Please note, I don't mean their should not be punishments but they should be in private, between a parent and a child, otherwise the punishment is no longer respected and though disliked by the child, is understood as required by a loving parent who cares about them
I hope these two young lads can endure and get past this fathers abuse. I hope they don't get into drugs or gangs as a result of not feeling loved at home or having a father who they can make proud. I hope this father is embarrassed by this public humiliation of his sons rather than getting off on all the shares and likes he is receiving.
The West Africa country of Liberia was founded as a colony of America in 1822 by American Colonization Society.
It's capital, Monrovia, was named after the then US President, James Monroe.
I think this is the best thing I have read regarding the entire Ferguson issue.
At some point while I was playing or preparing to play Monday Night Football, the news broke about the Ferguson Decision. After trying to figure out how I felt, I decided to write it down. Here are my thoughts:
I'M ANGRY because the stories of injustice that have been passed down for generations seem to be continuing before our very eyes.
I'M FRUSTRATED, because pop culture, music and movies glorify these types of police citizen altercations and promote an invincible attitude that continues to get young men killed in real life, away from safety movie sets and music studios.
I'M FEARFUL because in the back of my mind I know that although I'm a law abiding citizen I could still be looked upon as a "threat" to those who don't know me. So I will continue to have to go the extra mile to earn the benefit of the doubt.
I'M EMBARRASSED because the looting, violent protests, and law breaking only confirm, and in the minds of many, validate, the stereotypes and thus the inferior treatment.
I'M SAD, because another young life was lost from his family, the racial divide has widened, a community is in shambles, accusations, insensitivity hurt and hatred are boiling over, and we may never know the truth about what happened that day.
I'M SYMPATHETIC, because I wasn't there so I don't know exactly what happened. Maybe Darren Wilson acted within his rights and duty as an officer of the law and killed Michael Brown in self defense like any of us would in the circumstance. Now he has to fear the backlash against himself and his loved ones when he was only doing his job. What a horrible thing to endure. OR maybe he provoked Michael and ignited the series of events that led to him eventually murdering the young man to prove a point.
I'M OFFENDED, because of the insulting comments I've seen that are not only insensitive but dismissive to the painful experiences of others.
I'M CONFUSED, because I don't know why it's so hard to obey a policeman. You will not win!!! And I don't know why some policeman abuse their power. Power is a responsibility, not a weapon to brandish and lord over the populace.
I'M INTROSPECTIVE, because sometimes I want to take "our" side without looking at the facts in situations like these. Sometimes I feel like it's us against them. Sometimes I'm just as prejudiced as people I point fingers at. And that's not right. How can I look at white skin and make assumptions but not want assumptions made about me? That's not right.
I'M HOPELESS, because I've lived long enough to expect things like this to continue to happen. I'm not surprised and at some point my little children are going to inherit the weight of being a minority and all that it entails.
I'M HOPEFUL, because I know that while we still have race issues in America, we enjoy a much different normal than those of our parents and grandparents. I see it in my personal relationships with teammates, friends and mentors. And it's a beautiful thing.
I'M ENCOURAGED, because ultimately the problem is not a SKIN problem, it is a SIN problem. SIN is the reason we rebel against authority. SIN is the reason we abuse our authority. SIN is the reason we are racist, prejudiced and lie to cover for our own. SIN is the reason we riot, loot and burn. BUT I'M ENCOURAGED because God has provided a solution for sin through the his son Jesus and with it, a transformed heart and mind. One that's capable of looking past the outward and seeing what's truly important in every human being. The cure for the Michael Brown, Trayvon Martin, Tamir Rice and Eric Garner tragedies is not education or exposure. It's the Gospel. So, finally, I'M ENCOURAGED because the Gospel gives mankind hope.
This was posted on Facebook by Benjamin Watson, Tight End for the New Orleans Saints.
The goal is to have all this done before January 1, 2015 so that I can start writing on a consistent schedule for the new year.
I am considering coming up with a list of 12 different topics that I'll write an essay on in 2015 and publishing that list of topics with or without a schedule with the idea of putting publicly stated goals will hold me more accountable.
Some initial ideas I gave him for projects in learning AngularJS and/or Django/Flask:
I suggested his brainstorm up a dozen or so web application/game ideas that are well known and that interest him before he starts so he doesn't get blocked on coming up with a new idea. Focus less on an idea being good or bad, the what it is is not important.
I have found the YouVersion app to be a great experience to follow reading plans and access whatever version I want (my favorite is the ESV).
Sublime Text 3
I re-download, install, and enter my license key for ST3.
I install Package Controller along with the following packages:
My user preferences:
The movie looks fantastic!
Whenever a new OS comes up, I like to take the opportunity to start fresh rather than upgrade.
every triple in the RNA defines what amino acid goes next in the protein
WOD #2 for Paleo Challenge
AMRAP, 9:00
I ended up finished the last 7 burpees but not enough time to start the AMRAP of 155#. Leaving me with a total score of 78
.
Edward Buchner discovered, and won a nobel prize for it, that yeast was getting into the juice from the air and it was converting the juice to alcohol. he called these particle enzymes.
Yeast was understood as a substance but then it became known that it was actually a living thing.
Buchner discovered that it was something inside the yeast, not the the yeast itself. he was able to extract a chemical from the yeast and reproduce fermentation with it.
Now, my daughter wants me to teach her. I have been apprehensive about it though as I am concerned if I did something wrong with Ben that I might spoil it for Clare also, and I do not want that to happen.
This stacking can create problems when you have overlapping elements that might not be visible all the time.
Example: A tooltip g
or rect
that has an opacity: 0
that should only appear when hovering over a certain part of your visualization. The part where the tooltip is will catch the mouseover
(and other) mouse events blocking an area of your visualization.
You can avoid this behavior by setting pointer-events="none"
on your tooltip object like so: tooltip.attr('pointer-events', 'none')
.
This article is a about five years old but found it helpful in reading a summary of the different positions held by Piper and Wright.
I didn't want to spend a ton of money on a standing desk without at least trying it out so one afternoon I sketched up some specs, took some measurements and built two legs to put my existing desk on as well as a monitor raise to get my monitor at eye level.
It still a bit early for atom-flake8. It is crashing my editor and reports from others that it's not working too well when it doesn't crash. But good to see there is a start on it. Perhaps I'll fork it and help.
Katie had mentioned a link in her lighting-talk to a Github repo with the curriculum for running a class. But I don't remember nor am unable to find it right now. However, I think that would be a very doable thing to do at my kid's school one Saturday.
Data Storytelling the Pixar Way from my pals at Juice Analytics.
I especially love #11 and how it relates to how ThoughtStreams can be valuable in getting ideas to "paper".
God often blesses us with a "grace given" in the circle of "grace denied."
Future Grace, chapter 4, location 1389
So I am already tired of the unlock animation. I wonder if I can turn it off. It was snazzy the first couple of times but now it just feels slow.
Here is a great video profile of Adam Brown:
There were large strikes by workers in response to pay cuts and/or layoffs. This was everyone's first time at this (or so it seems to me from my read of the history).
Management not having precedent to figure out how to deal with lower demand/economic contraction while having a large workforce. It certainly didn't make sense business-wise to continue producing when you couldn't sell at the same volumes previously.
Labor seems to be first realizing that they can in fact collectively refuse to work and put pressure back on Management to comply with demands.
While yet an undergraduate student, Coolidge had the wisdom and foresight to recognize just how short-sighted this striking business was. Labor might win in the short term but were only hurting themselves in the long run.
I think this is part of when the story of Coolidge starts to crystalize some of his socio/economic/political opinions. One thing is for certain, is that he was thinking through these issues on his own rather than adopting the views of those around him or from his upbringing.
He seems to have been an extremely reflective and thoughtful individual who was not afraid at where a course of reason and logic might take him.
When tax rates are reduced, investment in productive enterprise is encouraged. When productive enterprise receives investment capital, the workers must be hired to produce output to yield a return on that investment. When value is created through this labor in a new enterprise, our economy expands and new wealth is created. When new wealth is created taxes are paid on income that didn't previously exist.
As a result of lower tax rates and more productive investment, there are more jobs and less unemployment. Less unemployment means more income (that didn't previously exist) which taxes are extracted from. If the venture succeeds and new wealth is created for the investors, again, more taxes are paid on gains that didn't previously exist.
Growth comes through analogy, through seeing how things connect rather than only seeing how they might be different.
—Sir Ken Robinson, The Element: How Finding Your Passion Changes Everything
Just produced a Littlewood fractal of (18 degrees/400 size) but it seems skewed, perhaps I made an error in transposing the code when moving to scripts:
Now it's just getting the SGE plugin in SAGA-python working. So far just all kinds of SSH connection issues.
Streams by this user that have been favorited by others.
shopt -s histappend
will append to history without ever wiping it out
history -a
will update your history immediately.
history -n
will read from history file when run instead of just at start of terminal.
So, add the shopt -s histappend
to your .bash_profile
or .bashrc
and then set your PROMPT_COMMAND
with the history commands like so:
export PROMPT_COMMAND="history -a; history -n"
This dog...
Beginning of an evening 5 mile walk...
It's really disturbing to me to see all the anti-police sentiment flung about on social media.
Should police that abuse their positions be held accountable? Absolutely.
Should we paint the picture that all cops are bad because of the actions of a few. Absolutely not. This is the same thing as racism and is hypocritical of those defending the riotous behavior to accuse police in general.
People aren't perfect. People do bad things. Doesn't matter if that person is a cop, is black, is white, purple or yellow. They are individuals. This whole grouping of people is problematic.
We need peace. I think most people despite what the media portrays yearn for peace. I don't know why it's permissible to riot, destroy property, throw garbage cans at bystanders, best people up. But I really don't understand folks that defend these lawless violent actions when in the same breath they seem to indict all police officers who by and large risk their lives daily to protect our life and property.
America seems upside down and backwards these days and it makes me sad.
The most difficult thing in the world is to know how to do a thing and to watch someone else do it wrong without comment.
-Theodore H. White.
Thought provoking talk
So very proud of my grandfather and what he built, but more importantly, how he built it.
Just saw this on Serious Wonder's Facebook post:
This is a picture from the Curiosity Rover on Mars showing Earth from the Perspective of Mars. You are literally looking at your home from the Perspective of another planet.
shopt -s histappend
will append to history without ever wiping it out
history -a
will update your history immediately.
history -n
will read from history file when run instead of just at start of terminal.
So, add the shopt -s histappend
to your .bash_profile
or .bashrc
and then set your PROMPT_COMMAND
with the history commands like so:
export PROMPT_COMMAND="history -a; history -n"
In Django forms, you can either use exclude
or fields
to list a set of fields to exclude or include on the ModelForm
.
I prefer to use fields
to explicitly include fields on a form because it's easy to add fields to a model without thinking through it's use on a form somewhere in your project. However, if you are adding a field for the purpose of adding it to a form you'll have the form in mind so explicitly adding the field to the fields
list will not be forgotten about.
This dog...
Always run git clean -fdx
prior to creating a Python release to eliminate possibility of unknown bits getting including in your package.
Discovered a file I had deleted from a previous release laying around in a build/
directory that was getting shipped with subsequent releases somehow, but only in the wheel
releases, not the standard sdist
.
The full details of my fixes can be found in this commit.
I'd like to point the fixes individually though as well:
The first example was just a case of reversing the logic so that I only re-raise the exception if it's not the thing we want to ignore. No wizardry there.
The next fix is probably one of my favorite tricks. Often you want to effectively retrieve a single object or return None. It's ok if it doesn't exist and if multiple exist you just need the first one. You can either write a queryset check the count or exists before indexing into it, or wrap a get in a try/except (which is what I originally had in this case), or you can use next
and iter
do things in a single line and single query. In this example, it was:
customer = next(iter(queryset)), None)
Then you can check if the customer
is None and act on it accordingly.
The third fix was simply checking for the existence of the field name in a way that wouldn't raise an exception. In this specific case, I want to add the ability to search by a user's email if the user model in question has an email field like the default django.contrib.auth.User
has.
In the fourth and last fix I simply needed to use the .get()
method on the response
object then I could avoid needing to worry about the KeyError
all together.
A recent thing that Jason brought to my attention today was bandit. So without delay, I installed and ran it with defaults against pinax-stripe
. It reported three issues that previous static analyzers failed to point out:
Run metrics:
Total lines of code: 2547
Total lines skipped (#nosec): 0
Total issues (by severity):
Undefined: 0.0
Low: 3.0
Medium: 0.0
High: 0.0
Total issues (by confidence):
Undefined: 0.0
Low: 0.0
Medium: 0.0
High: 3.0
All three issues were cases of using pass
in a try/except
block.
Recently, I've been doing a lot of work prepping a relaunch of django-stripe-payments, renamed along the way to pinax-stripe.
In this process, I have gone down the rabbit hole of trying all kinds of static analysis things to help inform and drive quality up.
On the prompting of Jason Myers, I'm going to try my best to keep a journal of little code puzzles and improvements that I make in the course of writing and maintaining open source code in my never ending search for higher quality code.
So far we have been teaching him:
He has all of these commands down somewhat. Of course being 14 weeks old he is still easily distracted. He is probably best at Sit and Leave It. Come works best if he thinks you are about to play with him or he isn't interested in something else, like a leaf.
There is a lot of different crate training advice on the internet and it's all pretty much the same and for the most part is what we followed.
Two aspects that we haven't followed is the idea of never forcing him in and never using the create as punishment.
We have certainly forced him to go in. It's not a violent shoving but we initially had to coax him in with some gentle pushing.
Also, when he starts getting wild, or biting on too many things, he gets a timeout in his crate to settle down. We don't make a big deal about it but do pull him over by his collar and tell him to get in.
It has worked great.
The first thing we did was decide to Crate Train as a method of housebreaking and reducing the number of inside accidents.
The idea is that if the dog spends most of his time in his crate and is taking outside immediately after getting out of his crate, he'll learn to relieve himself outside and associate outside with where you eliminate.
This works because dogs instinctually won't mess in their own den and it will take a while for him to think of the whole house as his den, but will get the crate immediately, given the crate is not too large for him.
The crate also becomes a safe place for him to sleep at night. Safe for him as well as for our furniture!
Lastly, he will have a place to retreat to if things scare or startle him.
If we are going to have a dog, it is going to be a well-trained dog, or at least we will make the attempt to have him well-behaved.
This means there is a lot to learn, fast.
We recently got a 9-week old "golden doodle" (standard poodle sire, golden retriever dam).
We named him Cash, after Johnny Cash, of course.
I was using the axios
library this morning to do some simple AJAX requests and was hitting an issue with the CSRF token header and cookie name being different in that library than what my server expects.
I figured out how to override them by doing the following in the module where I am using axios
:
Caffeine offsets health damage from stress! Oh boy oh boy oh boy! http://t.co/SmusQLT3H1
— Marc Andreessen (@pmarca) June 18, 2015
one of the most costly mistakes in investing is to let people who failed once at an idea talk you out of trying a very similar idea again.
— Sam Altman (@sama) June 5, 2015
Hospitals get reimbursed 18% of their charges to #medicare. Who's zooming who?
— J. Tod Fetherling (@jtodwork) June 5, 2015
Beginning of an evening 5 mile walk...
Thoughts by this user that have been liked by others.
The most awesome and terrifying experience of my life so far (and I imagine it will never be matched by anything else) is that of being a father.
Safari
I was a big user of Chrome previously but want to give Safari a chance to be my default browser.
I am a heavy user of Trello and one thing that I am noticing missing are the styles I had for Trello from http://userstyles.org.
I found Stylish which allows me to install two styles that brings back the card numbers and list counts.
Ok, figured it out. Apparently there are a lot of issues with this combination and how SublimeLinter ferret outs the path.
It's less than ideal but in the User settings for the SublimeLinter, I added the following to the paths for OS X:
"paths": {
"linux": [],
"osx": [
"/usr/local/Cellar/pyenv/20141012/versions/2.7.8/bin/"
],
"windows": []
},
This points to the pyenv
I created for the installed Python.
Just saw this on Serious Wonder's Facebook post:
This is a picture from the Curiosity Rover on Mars showing Earth from the Perspective of Mars. You are literally looking at your home from the Perspective of another planet.
So very proud of my grandfather and what he built, but more importantly, how he built it.
.@h0d3r has perhaps the most distressing complete twitter account history I've ever seen pic.twitter.com/Mkie17ndys
— Drew (@drewwww) November 20, 2014
A recent thing that Jason brought to my attention today was bandit. So without delay, I installed and ran it with defaults against pinax-stripe
. It reported three issues that previous static analyzers failed to point out:
Run metrics:
Total lines of code: 2547
Total lines skipped (#nosec): 0
Total issues (by severity):
Undefined: 0.0
Low: 3.0
Medium: 0.0
High: 0.0
Total issues (by confidence):
Undefined: 0.0
Low: 0.0
Medium: 0.0
High: 3.0
All three issues were cases of using pass
in a try/except
block.
Always run git clean -fdx
prior to creating a Python release to eliminate possibility of unknown bits getting including in your package.
Discovered a file I had deleted from a previous release laying around in a build/
directory that was getting shipped with subsequent releases somehow, but only in the wheel
releases, not the standard sdist
.