<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="http://joetsuihk.com/zh-hant/taxonomy/term/243/all" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>checkbox</title>
    <link>http://joetsuihk.com/zh-hant/taxonomy/term/243/all</link>
    <description></description>
    <language>zh-hant</language>
     <atom:link href="http://joetsuihk.com/zh-hant/taxonomy/term/243/all/feed" rel="self" type="application/rss+xml" />
      <item>
    <title>Django 可選 checkbox 的正確設定方式</title>
    <link>http://joetsuihk.com/zh-hant/django_%E5%8F%AF%E9%81%B8_checkbox_%E7%9A%84%E6%AD%A3%E7%A2%BA%E8%A8%AD%E5%AE%9A%E6%96%B9%E5%BC%8F</link>
    <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;&lt;img src=&quot;https://www.djangoproject.com/m/img/site/hdr_logo.gif&quot; /&gt;&lt;br /&gt;
使用 Modelform 的話，建立一個可選的 checkbox 還真要小心&lt;br /&gt;
例如 opt-in 類，“Check the box if you do not want to be contacted by us&quot;&lt;br /&gt;
Model:&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;#model.py&lt;br /&gt;class UserProfile(models.Model):&lt;br /&gt;    opt_in = models.BooleanField()&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;ModelForm:&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-taxonomy-vocabulary-2 field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Free tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/zh-hant/free_tags/django&quot;&gt;django&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot;&gt;&lt;a href=&quot;/zh-hant/free_tags/checkbox&quot;&gt;checkbox&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/zh-hant/free_tags/modelform&quot;&gt;modelform&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-add-this field-type-addthis field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a class=&quot;addthis_button &quot; addthis:title=&quot;Django 可選 checkbox 的正確設定方式 - JOE Tsui&amp;#039;s Drupal life in Hong Kong (香港)&quot; addthis:url=&quot;http://joetsuihk.com/zh-hant/django_%E5%8F%AF%E9%81%B8_checkbox_%E7%9A%84%E6%AD%A3%E7%A2%BA%E8%A8%AD%E5%AE%9A%E6%96%B9%E5%BC%8F&quot;&gt;&lt;img src=&quot;http://s7.addthis.com/static/btn/sm-share-en.gif&quot; alt=&quot;Share page with AddThis&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
     <pubDate>Mon, 16 Jul 2012 15:45:07 +0000</pubDate>
 <dc:creator>JOE</dc:creator>
 <guid isPermaLink="false">299 at http://joetsuihk.com</guid>
  </item>
  </channel>
</rss>
