I am confused on how to implement a Django model with the value being a special html character code for making a chessboard. As a reference I'm looking at a sudoku board model:
class Board(models.Model):
name = models.CharField(max_length=4, primary_key=True)
value = models.SmallIntegerField()
The value for sudoku is easy, since the table will only be filled with numbers. For reference here's a snippet from the sudoku page_data dictionary in views.py giving each table cell its appropriate value:
{"r1c1": 6, "r1c2": 7, "r1c3": 0, ...}
I don't know what to put for my model's value variable:
class Board(models.Model):
name = models.CharField(max_length=2, primary_key=True)
value =
Here's a snippet of where I assign the name/value pairs in my views.py with the special HTML chess piece character codes in my own page_data dictionary:
{"a8": html.unescape('♖'), "b8": html.unescape('♘'), "c8": html.unescape('♗'), ...}
Any help is appreciated.