#100DaysofCode Day 12

I fully admit I’m slacking with the documenting– I’m getting so wrapped up in whatever’s caught my eye that day, that I forget to jot it down here after I jot it down in my notebook when it’s time to walk away for the day. (as an aside: all this learnin’ has reminded me how much I love to just WRITE stuff in notebooks. I retain everything a lot better if I physically write it with a pen and paper. So far I’ve gone through half a box of pens, and countless random pens, several notebooks, and my hands are TIRED.)

I’ve been working with Django more. Current project: a CATalogue of my cats. (get it? CATalogue?) I’ve created the model and the view(s) and next on my agenda is to figure out how to get image files in on this action. Because what’s the point of cataloguing my cats, if I’m not including pictures with adorable captions and descriptions?

example: models.py
from django.db import models
class CatProfile(models.Model):
cat_name = models.CharField(max_length=200)
# should change this to approximate year of birth:
cat_age = models.IntegerField("cat's age")
cat_desc = models.CharField(max_length=200)
def __str__(self):
return self.cat_name
def elderly(self):
return self.cat_age >= 10
elderly.short_description = 'Is this cat a senior?'

#100DaysofCode Days 5 & 6

Continuing with the Django tutorial… and discovered Django Girls, too, a UK-based nonprofit.

I hadn’t yet seen SQL in classes, and it’s just so… eloquent. I like it.

class Choice(models.Model):
    question = models.ForeignKey(Question, on_delete = models.CASCADE)
    choice_text = models.CharField(max_length = 200)
    votes = models.IntegerField(default = 0)
    def __str__(self):
        return self.choice_text