擅长:python、mysql、java
<p>可以在验证前使用<code>clean_email</code>方法中的<code>self.data</code>访问POST数据。它应该包含一个名为<code>newsletter_sub</code>或<code>newsletter_unsub</code>的键,具体取决于按下了哪个按钮。</p>
<pre><code># in the context of a django.forms form
def clean(self):
if 'newsletter_sub' in self.data:
# do subscribe
elif 'newsletter_unsub' in self.data:
# do unsubscribe
</code></pre>