On March 22, 2023 11:40:00 PM CDT, Shubhi Pandey <shubhipandey202000@gmail.com> wrote:
the error is:django.core.exceptions.FieldError: Unknown field(s) (e-resource) specified for Postmodels.pyclass Post(models.Model):e_resource = models.FileField(null=True,blank=True,validators=[FileExtensionValidator( ['pdf'] ) ],upload_to='')views.pydef uploadResource_details(request,shop):shop = workshop_details.objects.get(w_id=shop)if request.method == 'POST':form = PostForm(request.POST, request.FILES)if form.is_valid():cdform = form.cleaned_datacdform.save()return HttpResponse("File Uploaded successfully")else:form = PostForm()return render(request, 'uploadAttendance.html', {'form': form,'shop' : shop})forms.pyclass PostForm(forms.ModelForm):class Meta:model = Postfields = ['e-resource']
No comments:
Post a Comment