Login

Tag "datefield"

Snippet List

Browser-native date input field

Most modern browsers support the new `<input type="date">`, which allows inputting date using a browser-native date picker with built-in validation. This form widget utilizes this feature by setting the input type to "date" and by changing the value formatting as it should be in the ISO format. See more about `<input type="date">`: <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date>

  • forms
  • datefield
  • widget
  • input
Read More

Credit Card With Newforms

Alternative version of newform code for handling credit cards. Unlike the other two credit-card snippets (http://www.djangosnippets.org/snippets/764/ and http://www.djangosnippets.org/snippets/830/), this uses two drop-down boxes instead of text fields for the expiration date, which is a bit friendlier. It doesn't do as much checking as snippet #764 since we rely on the payment gateway for doing that. We only accept Mastercard, Visa, and American Express, so the validation code checks for that.

  • newforms
  • datefield
  • credit-card
  • expiration-date
Read More

Custom DateField To Handle Credit Card Exp Date. Format: MM/YY

As users would login to their accounts to update their CC info, the expiration date always threw them off. The default format for displaying a datetime.date object is >YYYY-MM-DD Obviously the expiration date on your credit card uses the MM/YY format. I finally got around to creating a custom field/widget to handle this particular piece of data. Use like so... class CustomerForm(forms.ModelForm): cc_exp = DateFieldCCEXP() class Meta: model = Customer

  • datefield
  • credit-card
  • expiration-date
Read More
Author: pjs
  • 1
  • 3

Drop down Datefield

Simple drop-down date field for use. You can specify date range by initiating new DateDropdownWidget. Welcome comments!

  • newforms
  • forms
  • dropdown
  • datefield
  • field
Read More

5 snippets posted so far.