Categories
Uncategorized

Misc Django I – forms

Custom form errors If you want to validate something in the view, and return with a custom error message in the same form, you can use the “Form.add_error(fieldname, errorstring)” method. And then, of course, return to the previous template. class MyView(View): def get(self, request): data = form.cleaned_data if len(res) > 0: form.add_error( ‘login’, “Diese Personalnummer […]

Categories
Uncategorized

Django, psql & “permission denied” on migrate

I got this error: psycopg2.ProgrammingError: permission denied for relation django_migrations … when I wanted to do a “python manage.py migrate”. This post had the solution. In short: You have to change the owner of the tables to the one specified in the Django configuration. This is how my script looks: #!/usr/bin/env bash echo “ALTER TABLE […]

Categories
Uncategorized

Microsoft Code and Typescript

So being on the enterJS conference I wanted to get started with JavaScript. And TypeScript seems really promising. And once again I stumbled over the DIW pattern – Download, Install, Weird error messages. So, here’s my take on how to get started. I wanted … ┬áto try node-hid to see my USB HID devices, using […]