django - can't view data on django admin page
<p>Here are the models I am working with:</p>

<pre><code>class Customer(models.Model):
    customer_id = models.AutoField(primary_key=True, unique=True)
    full_name = models.CharField(max_length=50)
    user_email = models.EmailField(max_length=50)
    user_pass = models.CharField(max_length=30)

    def __str__(self):
        return "%s" % self.full_name

class CustomerDetail(models.Model):
    phone_regex = RegexValidator(regex = r'^\d{10}$', message = "Invalid format! E.g. 4088385778")
    date_regex = RegexValidator(regex = r'^(\d{2})[/.-](\d{2})[/.-](\d{2})$', message = "Invalid format! E.g. 05/16/91")

    customer = models.OneToOneField(
        Customer,
        on_delete=models.CASCADE,
        primary_key=True,
    )
    address = models.CharField(max_length=100)
    date_of_birth = models.CharField(validators = [date_regex], max_length = 10, blank = True)
    company = models.CharField(max_length=30)
    home_phone = models.CharField(validators = [phone_regex], max_length = 10, blank = True)
    work_phone = models.CharField(validators = [phone_regex], max_length = 10, blank = True)

    def __str__(self):
        return "%s" % self.customer.full_name
</code></pre>

<p>Here is the <code>forms.py</code>:</p>

<pre><code>from django.forms import ModelForm

from .models import CustomerDetail

class CustomerDetailForm(ModelForm):
    class Meta:
        model = CustomerDetail
        fields = ['address', 'date_of_birth', 'company', 'home_phone', 'work_phone',]
</code></pre>

<p>I have a view in my application (after user is logged in) called <code>create_profile</code> that asks the user for additional details and I used ModelForm instance to implement it. Here is the snippet from <code>views.py</code>:</p>

<pre><code>def create_profile(request):
if request.POST:
    form = CustomerDetailForm(request.POST)
    if form.is_valid():

        address = form.cleaned_data['address']
        date_of_birth = form.cleaned_data['date_of_birth']
        company = form.cleaned_data['company']
        home_phone = form.cleaned_data['home_phone']
        work_phone = form.cleaned_data['work_phone']

        profdata = CustomerDetail(address = address, date_of_birth = date_of_birth, company = company, home_phone = home_phone, work_phone = work_phone)
        profdata.save()

        return render(request, 'newuser/profile_created.html', {form: form})
else:
    return redirect(create_profile)
</code></pre>

<p>When I fill the form on the corresponding template html and hit Submit, it shows me the successive page, but when I check the CustomerDetail entries on the admin page, I see a '-' in place of an actual record. Where am I going wrong here? Does it have to do with overriding the clean() method? Please help. Thanks!</p>

<p>You don't need to override <code>cleaned_data</code> in your case. Because you already using <code>ModelForm</code> which create <code>CustomerDetail</code> instance after <code>save</code> method called.<br>
View might look like this:    </p>

<pre><code>def create_profile(request):
    if request.method == 'POST':
        form = CustomerDetailForm(request.POST)
        if form.is_valid():
            form.save()
            return render(request, 'newuser/profile_created.html', {'form': form})
    else:
        form = CustomerDetailForm()
    return render(request, 'path_to_create_profile.html', {'form': form})
</code></pre>

<p><a href="https://docs.djangoproject.com/en/1.10/topics/forms/#the-view" rel="nofollow">check the docs about forms</a></p>

python django django-forms modelform