Skip to content

Instantly share code, notes, and snippets.

@Neceros
Last active October 3, 2016 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neceros/5552a53f88e1d4c6927879271096cd5e to your computer and use it in GitHub Desktop.
Save Neceros/5552a53f88e1d4c6927879271096cd5e to your computer and use it in GitHub Desktop.
How do I get a each field within Event to be random, and not correlate with itself? When I call a new Event I wish each of the fields to have a random entry from the database.
from django.db import models
class Event(models.Model):
subject = models.CharField(max_length=256)
what = models.CharField(max_length=512)
where = models.CharField(max_length=256)
extra = models.CharField(max_length=1024)
def __str__(self):
return "{} {} {} {}".format(
self.subject,
self.what,
self.where,
self.extra,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment