Adding a field to the profile: Difference between revisions

no edit summary
imported>Mark
No edit summary
imported>Mark
No edit summary
Line 4:
 
[[File:Mark_bio_before.png|link=|left]]
 
 
Today, on July 4, 2011, [http://openhatch.org/people/Mark/ my OpenHatch profile] doesn't have a special field for my birthday. When I go to edit my profile, there's no place to put it in!
Line 20 ⟶ 21:
 
If you try this and you get stuck, come come [[chat with us on IRC]]. Explain what you're doing, and what's not working, and we'll try to get you un-stuck. The same goes for if you can ''do'' the exercises but don't understand what they ''mean''.
 
 
== Getting the source ==
Line 35 ⟶ 37:
Author: Asheesh Laroia <asheesh@asheesh.org>
Date: Wed Jun 29 11:38:31 2011 -0400
 
Add a config option that enables cookie sharing for Vanilla ProxyRequest-bas
 
Line 51 ⟶ 52:
On your own development instance, open up [http://127.0.0.1:8000/people/Mark/ Mark's OpenHatch profile] in a browser tab. Inside the "Info" box, there are sections like my "bio" and "web site". It should look like the screenshot at the top of this page.
 
Let's add a new one, "IRC nickBirthday".
 
= The 'Where': finding the right spot to make changes =
Line 104 ⟶ 105:
That seems to be what generates the person homepage link. It's in the context of a <pre><div id='info' class='module'></pre>
 
=== Edit 1: Let's give everyone the same IRC nickbirthday ===
 
[[File:Asheesh-info-box-with-irc-nick.png|link=|left]]
 
Okay, so let's edit the template so that every profile page says their IRC nickbirthday is <tt>drwormJanuary 1, 1980</tt>.
 
Just jam this right below the homepage section:
 
<pre>
<h4>IRC nickBirthday</h4>
<p>drwormJanuary 1, 1980</p>
</pre>
 
Line 127 ⟶ 128:
<div class="example"><pre>
$ git diff --color
diff --git a/mysite/profile/templates/profile/base_profile.html b/mysite/profile/templates/profile/base_profile.
index f7b75b61503658..16bc331864b3a7 100644
--- a/mysite/profile/templates/profile/base_profile.html
+++ b/mysite/profile/templates/profile/base_profile.html
@@ -157176,6 +157176,9 @@
</p>
{% endif %}
+ <h4>IRC nickBirthday</h4>
+ <p>drwormJanuary 1, 1980</p>
+
{% commentif person.irc_nick %}
<divh4>irc class="tags" id="tags-links"nick</h4>
<spanp classid="tag-typeircnick">links style='clear:</span both;'>
</pre></div>
 
Line 146 ⟶ 147:
 
<div class="example"><pre>
$ git commit -a -m "base_profile.html: Now everyone's profile says they usewere theborn drwormon IRCJanuary nick1, 1980.
</pre></div>
 
Line 153 ⟶ 154:
The next things to do are:
 
* Add something like person.homepage_url so that each person can have their own IRC nickBirthday.
* [[Making schema changes|Write a migration file]] to add that column to our database.
* Write a form so people can edit their IRC nicksBirthday.
* Write a test.
 
Anonymous user