Archives

  • Django Bootstrap Extra Form Buttons

    This is how I have been implementing extra buttons on my forms via Django Bootstrap. # In context of form model class XUpdateForm(forms.ModelForm): … def clean(self): cleaned_data = super(XUpdateForm, self).clean() # Add action to clean data cleaned_data[‘action’] = self.data[‘action’] return cleaned_data Now in the view responsible for this form form = XUpdateForm(request.POST) obj = form.save(commit=False) […]

    Dec 9th, 2017 • Filed under Django, PythonPrint View
  • Django Multiple Settings Structure

    In my Django projects, I tend to break outĀ settings.py into multiple files. This keeps settings for different environments separate from each other. You might want to have debugĀ settings for development environments only. Example settings structure: (cormier) [[email protected] cormier]$ ls cormier/settings/ base.py development.py __init__.py production.py testing.py (cormier) [[email protected] cormier] At the top of settings files import […]

    Oct 12th, 2017 • Filed under Django, PythonPrint View
  • Update MySQL Server Time Zone Data

    I started to get the error message Database returned an invalid value in QuerySet.dates(). Are time zone definitions and pytz installed? from a Django application. These messages presented when I started to utilize date_hierarchy. From the MySQL server run the following command mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root -p mysql This will parse the zone […]

    Nov 11th, 2016 • Filed under Databases, Django, Linux, MySQL, PythonPrint View
Archive for the ‘Django’ Category