Hi Salimon, 

Thank you for the code and help.
When I update to your code I get the following error in the browser

Exception Type: AttributeError
Exception Value:        
'ModelFormOptions' object has no attribute 'concrete_fields'
Im not sure why 

my models.py

class Businessownercreate(models.Model):
        Creator = models.CharField(max_length=20)
        Micro_Small_Medium = models.CharField(max_length=6)
        Business_Name = models.CharField(max_length=20)
        Owner_Firstname = models.CharField(max_length=20)
        Owner_Surname = models.CharField(max_length=20)
        Companies_House_Number = models.CharField(max_length=8)
        Address_Line_1 = models.CharField(max_length=30)
        Address_Line_2 = models.CharField(max_length=30)
        Town = models.CharField(max_length=20)
        City = models.CharField(max_length=20)
        County = models.CharField(max_length=20)
        Postcode = models.CharField(max_length=10)
        Email = models.EmailField(max_length=50)
        Phone = models.CharField(max_length=15)
        Mobile = models.CharField(max_length=15)
        Created_date = models.DateTimeField(auto_now_add=True)
                        
def __str__(self):
        return self(Creator)

Pls advise if this is an error with my model?

Best,

K

On 18 Aug 2019, at 01:47, salimon jamiu olashile <tunedae1shi...@gmail.com> 
wrote:

> It seems the model & form class names are clashing. If you want use the same 
> name, you can import each module as a whole.
> 
> Edited:
> 
> from . import models, forms
> 
> def editbusiness(request):
>       data = models.Businessownercreate.objects.all() 
>       if request.method == "POST":    
>               form = forms.Businessownercreate(request.POST, 
> instance=Businessownercreate)
>               if form.is_valid():
>                       form.save()
>                       return redirect("accounts:editremovebusiness")
>       else:
>               form = forms.Businessownercreate(instance=Businessownercreate)
>               return render(request, 'editbusiness.html', { 'form':form })
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAFhdOCNUFeHnuF409CZQ%2BL9dB-p-D6CU3s_sso%2BGsZhsOqX3cg%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/C362552D-AF16-419A-8A6A-AF378822DB75%40gmail.com.

Reply via email to