Pnmscale -xsize=16 -ysize=16 tmp_favicon.pnm > tmp_favicon16.ppm Pnmscale -xsize=32 -ysize=32 tmp_favicon.pnm > tmp_favicon32.ppm pngtopnm -mix favicon.png > tmp_favicon.pnm I tend to use the 32x32 size.įor this example I start with a 32x32 favicon.png, convert it to an intermediary pnm file, force the scaling to a ppm file, convert to 256 color space, and compile it into an ico file with the following set of commands. Next, I'll start with a 16x16, 32x32 or 48x48 square pixel PNG. If you're using Ubuntu you're in luck, as with most things it's just an apt-get away. It took me a while, but there's a way to do it using some of the packages from netpbm. Even Photoshop doesn't have this built in: for that you need a plugin. I've always felt there had to be a way to convert a png to ico file. #DD DELICIOUS TUBBLER BLOG WINDOWS#I used to use the icon editor in Visual Studio in the past, but I haven't programmed in Windows for years and I don't have access to VS anymore. I've never had a great way of making windows icon files (.ico). Now, when I initialize the birthday field in the form instead of displaying YYYY-MM-DD, it will look like MM/DD/YYYY which is more natural to an American audience. Or for a short-hand version that doesn't require overriding the form class could look something like the following: class ProfileForm(forms.Form):īirthday = forms.DateField(widget=forms.DateInput(format='%m/%d/%Y')), input_formats=('%m/%d/%Y',)) Last_name = forms.CharField(max_length=100) Super(FormattedDateField, self)._init_(*args, **kwargs)įirst_name = forms.CharField(max_length=100) Widget = forms.DateInput(format='%m/%d/%Y') It would look something like this: from django import formsįrom import ugettext_lazy as _Ĭlass FormattedDateField(forms.DateField): The easiest way I have found to change how the date field displays is to write a small custom form field that inherits from forms.DateField that overrides the widget. The default way the forms.DateField is displayed is YYYY-MM-DD, which is typically not what you want to present to the users. The DateField has an easy way to restrict how data is entered through the input_formats option but unless if I'm missing something there's isn't a similar way to help you set how the field displays the date in the template. Django forms are great, but sometimes you need to do a little work to get things just the way you want.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |