Advertisement
c32team

Data migration

Sep 21st, 2023
1,397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # testdb/models.py
  2. from django.db import models
  3.  
  4.  
  5. class Author(models.Model):
  6.     last_name = models.CharField(max_length=200)
  7.     first_name = models.CharField(max_length=200)
  8.     birth_date = models.DateField()
  9.  
  10.     class Meta:
  11.         db_table = 'authors'
  12.  
  13.  
  14. class Language(models.Model):
  15.     name = models.CharField(max_length=200)
  16.  
  17.     class Meta:
  18.         db_table = 'languages'
  19.  
  20.  
  21. class Book(models.Model):
  22.     title = models.CharField(max_length=200)
  23.     authors = models.ManyToManyField(Author)
  24.     available_languages = models.ManyToManyField(Language)
  25.  
  26.     class Meta:
  27.         db_table = 'books'
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement