Month: August 2014

MultiValueDictKeyError formset django

MultiValueDictKeyError formset django

When update data using formset and we got error “MultiValueDictKeyError” that’s high possibilites we forgot to add hidden fields in the form. Please check your formset to have hidden fields. Some example : 12345678910111213{% for form in residenceform %}     {% for field in form.visible_fields %}         <div class="form-group">     …

+ Read More

Solve UWSGI service not started in Ubuntu

Solve UWSGI service not started in Ubuntu

I found some weird bug when install uwsgi in Ubuntu 13.10 and 14.04 (after upgrade). When i run : 1sudo service uwsgi start No uwsgi services started and .ini are completely fine (executed with “uwsgi –ini my-app.ini”). I found simple solution by uninstall and reinstall uwsgi packages 12sudo apt-get remove –purge uwsgi uwsgi-plugin-python sudo apt-get …

+ Read More

Override and Rename Django form default errors globally

Override and Rename Django form default errors globally

Here is a quick way to override django forms default errors like this field is required, etc globally : 12345# form error message override from django.forms import Field Field.default_error_messages = {     ‘required’: _("Kolom ini wajib diisi."), }

Solve scroll in form type number bug in Chrome / Firefox

Solve scroll in form type number bug in Chrome / Firefox

Using form with type=”number” is great. But, the scroll seems annoying. Here is to avoid this issue using css : 123456789101112131415161718/* Fix input type number scroll */ input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {     /* display: none; <- Crashes Chrome on hover */     -webkit-appearance: none;     margin: 0; /* <– Apparently some margin are …

+ Read More

Import 3rd party custom python modules in Django

Import 3rd party custom python modules in Django

Sometimes we need to customized 3rd-party python modules and integrated with our Django. There are several options, but what i use here is the best for most cases. We should keep them separated from django and treat as python modules which we can install using “pip install”. Here is the solution, first we need to …

+ Read More