Saturday, October 29, 2016

Re: Newbie question - data structure for game

I am also quite new to django, but I will go with something like this;

class Quote(models.Model):
    quote= models.CharField(max_length=100)

class EncryptedQuote(models.Model)
    quote = models.ForeignKey(Quote, on_delete=models.CASCADE)
    encrypted_quote = models.CharField(max_length=100)


So, you can have multiple encryptions of any quote.

On Saturday, October 29, 2016 at 3:00:14 AM UTC+3, Ken Albright wrote:
I'm just learning Python and Django so please be gentle...

I've written a quote decryption game (like you see in the newspaper) in Python. I'd like to put it on a web page with Django. However, I'm not sure of the best way to structure the data. The original quote and the encrypted quote need to have a one-to-one relationship at the letter level. So it could be two strings on the same row (same id) or a set of tuples, a dictionary, or ???

How to set up the database and models.py?

Thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dc31d02e-8345-4467-99df-0e4688a76a48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment