my English is poor , sorry
this is my struct bookstore ---author(app1) ---book(app2)
from django.db import models
from author.models import Profile
from django.contrib import admin
class Book(models.Model):
title = models.CharField(max_length = 150)
page = models.IntegerField()
price = models.IntegerField()
author = models.ForeignKey(
'Profile',
on_delete=models.CASCADE,)
publish_date = models.DateField()
class Meta(object): db_table = "book"
class BookAdmin(admin.ModelAdmin): pass
admin.site.register(Book, BookAdmin)
mysql have some data , now I want to use them to show my web ,not to do that creat data in database thank you guys!!!
I have a question My Django == 1.9 , python == 3 , windows10 I want to use mysql (my database contect is really do it) when I find some resource, I will see that "python manage.py sql [appname]" it is Django to SQL when I want to use Django to mysql Can I "python manage.py inspectdb"?? it will have a models.py "python manage.py sql [appname]" = "python manage.py inspectdb" ?
ERRORS: book.Book.author: (fields.E300) Field defines a relation with model 'Profile', which is either not installed, or is abstract. book.Book.author: (fields.E307) The field book.Book.author was declared with a lazy reference to 'book.profile', but app 'book' doesn't provide model 'profile'.
Aucun commentaire:
Enregistrer un commentaire