Upgrade to Pro — share decks privately, control downloads, hide ads and more …

炭酸飲料が飲めない学校で炭酸飲料を飲めるよにした話

Daniel
October 07, 2018

 炭酸飲料が飲めない学校で炭酸飲料を飲めるよにした話

Daniel

October 07, 2018
Tweet

More Decks by Daniel

Other Decks in Programming

Transcript

  1. データベース CREATE TABLE myapp_person ( "id" serial NOT NULL PRIMARY

    KEY, "first_name" varchar(30) NOT NULL, "last_name" varchar(30) NOT NULL );
  2. from ... import Person p1 = Person(first_name="Shogo", last_name="Takata") p1.save() p2

    = Person() p2.first_name = "Shogo" p2.last_name = "Takata" p2.save()
  3. 商品 class Item(models.Model): product_name = models.CharField(max_length=200) product_price = models.IntegerField() product_price_with_fee

    = models.IntegerField() added_date = models.DateTimeField(null=True) seller = models.ForeignKey(User, on_delete=models.SET_NULL,
  4. class Log(models.Model): product_name = models.CharField(max_length=200) product_price = models.IntegerField() product_price_with_fee =

    models.IntegerField() added_date = models.DateTimeField(null=True) deleted_date = models.DateTimeField(null=True) seller = models.ForeignKey( User, on_delete=models.SET_NULL, null=True, related_name buyer = models.ForeignKey( User, on_delete=models.SET_NULL, null=True, related_name