add file-uploade in the rgistration form

9 views
Skip to first unread message

Ahmed Alqhtani

unread,
Feb 21, 2019, 7:20:27 AM2/21/19
to General Open edX discussion
i create new app call : upload_file


 1- i create models.py :
from django.conf import settings
from django.db import models
from django.core.files import File


# Backwards compatible settings.AUTH_USER_MODEL
USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')


class upload(models.Model):
    user = models.OneToOneField(USER_MODEL, null=True)


    title = models.CharField(max_length=255, blank=True)
    fileup = models.FileField(upload_to='../../../../edx/var/edxapp/media/' )
    uploaded_at = models.DateTimeField(auto_now_add=True)
   


2- my forms.py :

from .models import upload
from django.forms import ModelForm
from django.core.files import File
from django.db.models import FileField


class uploadform(ModelForm):
   
        

     class Meta:
         model = upload
         fields = ('title', 'fileup')

3- my migration

every things look good in my localhost/admin i can upload my file and assign that to a user and  data inserted to database successfully

my issue is :
when i open my localhost
this is the page i got in my registration-page

and in my log.edx which is for LMS  i got :
Field type '{}' not recognized for registration extension field '{}

regpage.png



Reply all
Reply to author
Forward
0 new messages