0

I have created a model.py file in which I define my classes like:

from django.db import models
from mezzanine.pages.models import Page

class Author(Page):
    dob = models.DateField("Date of birth")

class Book(models.Model):
    author = models.ForeignKey("Author")
    cover = models.ImageField(upload_to="authors")

Then my HTML page and place it into templates folder define URL in urls.py file.

I run command python manage.py collecttemplates to get all templates

Now I browse 127.0.0.1/8000/page1/ to get my page view.

**Question 1: How to place this page in menu of home page using admin interface?

Question 2: How to solve this error 'NoneType' object has no attribute 'split' generates if I browse http://127.0.0.1:8000/admin/conf/setting/?

Question3 : How to access POST DATA from forms created in mezzanine interface?**

UPDATE:

from django.db import models
from mezzanine.pages.models import Page
class Author(Page):
    dob = models.DateField("Date of birth")

class Book(models.Model):
    author = models.ForeignKey("Author")
    cover = models.ImageField(upload_to="authors")

and admin.py with these:

from django.contrib import admin
from mezzanine.pages.admin import PageAdmin
from .models import Author  

admin.site.register(Author, PageAdmin)

Now i write these commands: python manage.py syncdb, python manage.py migrate,
and then open python shell to write Author.objects.create(dob = "12/12/2014")

That generates error that author is not defined. It's true because no tables created in my database.?!

Tameen Malik
  • 1,258
  • 6
  • 17
  • 45
  • I think for question 3 you're looking for the processor_for method: http://mezzanine.jupo.org/docs/content-architecture.html#page-processors – KhoPhi Nov 22 '15 at 21:57

1 Answers1

0

I assume you're working through the Content Architecture tutorial on the Mezzanine site. The tutorial assumes a lot on your part, which is not ideal for a beginner. If you haven't seen it, you might want to take a look anyway. Here it is: http://mezzanine.jupo.org/docs/content-architecture.html

To answer Question#1: You add the new content type via the Pages admin: http://127.0.0.1:8000/admin/pages/page/ Select from the drop-down menus that read "Add..." to select its type and on the following configuration page you can select where you want it displayed as a menu link.

In response to your UPDATE:

At the Djanog/Mezzanine Python shell:

from <your app> import models

Then try models.Author.objects.create(title="Dr. Seuss")

No ideas on Questions #2 & #3 right now.

Jared Nielsen
  • 135
  • 1
  • 9