Skip to content

Tag: django

Implementing CSS in Django

I’m trying to implement a simple CSS file to my python web app. When I try loding the app, I get a error message in the command prompt that says: And of course no CSS is implemented to the HTML page. The structure of my Project is: In my settings.py, I got: And in the html I got the link

How can auto create uuid column with django

I’m using django to create database tables for mysql,and I want it can create a column which type is uuid,I hope it can generate the uuid by itself,that means each time insert a record,I needn’t specify a uuid for the model object.How can I make it,thanks! Answer If you’re using Django >=…

Django change database field from integer to CharField

I have a Django app with a populated (Postgres) database that has an integer field that I need to change to a CharField. I need to start storing data with leading zeros in this field. If I run migrate (Django 1.8.4), I get the following error: I tried searching Google, but didn’t really find much help. …

Django Model Field Uniqueness Validation

I have a django user model that has fields ID, PW and DeviceID. The database I’m using is MySQL. In this model a user can have many different devices, so there can be many identical ID & PW (same user), with different DeviceIDs in the table. But if all the 3 fields are the same, then it is considere…