Firstly Hello ! I am Mezzanine newbie and I would like to have some help. I 
know there are many similar questions but no one answers my question.
I have a model called "Document" assiociated to a custom page "UploadPage" :

models.py :
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import settings as mezzSettings
from mezzanine.pages.models import Page, RichText



class UploadPage(Page, RichText):
     """Page pour l upload des annexes"""
     class Meta:
         verbose_name = _("Upload page")
         verbose_name_plural = _("Upload pages")

class Document(models.Model):
     """Modele representatif d un document annexe"
     docfile = models.FileField(upload_to=mezzSettings.PDT_VERSION)
     uploadpage = models.ForeignKey("UploadPage", related_name="files")


admin.py :
# -*- coding: utf-8 -*-
from django.contrib import admin

from mezzanine.core.admin import TabularDynamicInlineAdmin
from mezzanine.pages.admin import PageAdmin

from quentinApp.models import UploadPage, Document

class DocumentInline(TabularDynamicInlineAdmin):
     model = Document

class UploadPageAdmin(PageAdmin):
     inlines = (DocumentInline,)

admin.site.register(UploadPage, UploadPageAdmin)

This code works but I would like to add a form field in this page 
(displayed in the site) that allow an user to upload a file (no worries 
about the security it's an intranet site).
I have already tested with a "form page" with field form but I don't like 
the way it stores the documents (create an unique "jksdfdfjkhomp" key 
folder for the document).
Should I add a Custom form field wich upload a file and create the page 
related object "Document"... In the documentation I found the "fields_for" 
function so the custom form must be the key, but I have no ideas how to 
make it. 
Ps: I have some difficulties in expressing myself in English, do not 
hesitate to ask me if I was not clear.

Cordially,
Quentin

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to