Open radiac opened 1 month ago
Idea:
from django.db import models from nanodjango import Django app = Django() @app.admin class CountLog(models.Model): # Standard Django model, registered with the admin site timestamp = models.DateTimeField(auto_now_add=True) @app.route("/") def count(request): # Standard Django function view CountLog.objects.create() return f"<p>Number of page loads: {CountLog.objects.count()}</p>" def test_count(): assert CountLog.objects.count() == 0 CountLog.objects.create() assert CountLog.objects.count() == 1
then test with
nanodjango test counter.py
@marcgibbons is looking at this in #28
Idea:
then test with