Can you extend the admin form for my page?

1

I have a form created and displayed with the admin the way I want it ... however it is a site for user registration, so the user does not have access to the admin, I want the admin form to be used outside of it .

In my case the option fields are not appearing, for example they appear in the form inside admin

        from __future__ import unicode_literals

from django.db import models
from django.db import models


VINCULO = (
    (u'1', u'Bolsista'),
    (u'2', u'Estagiário'),
    (u'3', u'Terceiro'),
    (u'4', u'Servidor'),
    (u'5', u'Aluno Pós-Graduação'),
    (u'6', u'Servidor de outros órgãos'),
    (u'7', u'Professor Colaborador'),
)

SALAS = (
    (u'1', u'SysAdmin'),
    (u'2', u'Help Desk'),
)

RENOVADO = (
    (u'1', u'Sim'),
    (u'2', u'Não'),
)

EMPRESAS = (
    (u'1', u'Cray'),
    (u'2', u'Outra'),
)

TIPO = (
    (u'1', u'Técnico'),
    (u'2', u'Tecnologista'),
)


class Inscricao(models.Model):
        vinculo = models.CharField(max_length=100, choices=VINCULO)
        registro = models.IntegerField()
        nome = models.CharField(max_length=100)
        email = models.EmailField(unique=True)
        data_nascimento = models.DateField()
        data_admissao = models.DateField()
        sala = models.CharField(max_length=100, choices=SALAS)
        telefone = models.CharField(max_length=30)
        ramal = models.CharField(max_length=30)
        orientador = models.CharField(max_length=100)
        data_fim_contrato = models.DateField()
        renovado = models.CharField(max_length=4, choices=RENOVADO)
        empresa_responsavel = models.CharField(max_length=50, choices=EMPRESAS)
        tipo = models.CharField(max_length=50, choices=TIPO)
        criado_em = models.DateTimeField('criado em', auto_now_add=True)

        class Meta:
                ordering = ['criado_em']
                verbose_name = (u'nome')
                verbose_name_plural = (u'nomes')

        def __unicode__(self):
                return self.nome
    
asked by anonymous 31.07.2017 / 13:58

1 answer

0

By Django admin, only if the user has access.

If you want to create a form based on the characteristics of your templates in a frontend, I suggest using Django Forms .

Example:

forms.py

from django import forms

class NameForm(forms.Form):
    your_name = forms.CharField(label='Your name', max_length=100)

template.html

<form action="/your-name/" method="post">
    {% csrf_token %}
    {{ form }}
    <input type="submit" value="Submit" />
</form>
    
02.08.2017 / 15:41