June 2018
Beginner
508 pages
13h 8m
English
Now that the boilerplate is out of the way, and we have a couple of users, we're ready to code. We start by adding the Entry model to our application so that we can store objects in the database. Here's the code you'll need to add (remember to use the project tree for reference):
# entries/models.pyfrom django.db import modelsfrom django.contrib.auth.models import Userfrom django.utils import timezoneclass Entry(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) pattern = models.CharField(max_length=255) test_string = models.CharField(max_length=255) date_added = models.DateTimeField(default=timezone.now) class Meta: verbose_name_plural = 'entries'
This is the model we'll use to store regular expressions ...
Read now
Unlock full access