CREATE TABLE "LICENCE" ( "ID" NUMBER NOT NULL ENABLE, "VEH_ID" NUMBER NOT NULL ENABLE, "DTP_ID" NUMBER NOT NULL ENABLE, "LICENCENO" VARCHAR2(50 CHAR) NOT NULL ENABLE, "ISSUEDATE" DATE, "STARTDATE" DATE, "EXPIREDATE" DATE, "DOCPATH" VARCHAR2(500 CHAR), "CHECKFLAG" NUMBER(1,0) NOT NULL ENABLE, CONSTRAINT "LIC_PK" PRIMARY KEY ("ID") ENABLE, CONSTRAINT "LIC_DTP_FK" FOREIGN KEY ("DTP_ID") REFERENCES "DOCTYPES" ("ID") ENABLE, CONSTRAINT "LIC_VEH_FK" FOREIGN KEY ("VEH_ID") REFERENCES "VEHICLES" ("ID") ENABLE ) /With inspectdb, I got this table:class Licence(models.Model):id = models.DecimalField(unique=True, primary_key=True, max_digits=127, decimal_places=0) veh_id = models.ForeignKey(Vehicles, db_column='veh_id') dtp_id = models.ForeignKey(Doctypes, db_column='dtp_id') licenceno = models.CharField(max_length=200) issuedate = models.DateField(null=True, blank=True) startdate = models.DateField(null=True, blank=True) expiredate = models.DateField(max_length=2000, blank=True) docpath = models.CharField(max_length=200) checkflag = models.IntegerField() def __unicode__(self): return self.licencenoHow should I handle the upload?My thought after reading the file upload documentation was to modify the docpath to filefield. Is that the right practice?Because I tried it, and the form doesn't validate, I get the error "No file chosen". Can anyone guide me through this?Thank you..
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/eo_e4m3hye8J.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
def upload(request):
if "doc-form" in request.POST:
docform = LicenceForm(data=request.POST, files=request.FILES)
if docform.is_valid():
docform.save()
return render_to_response('bingo.html', locals(), context_instance=RequestContext(request)
else:
docform = LicenceForm()
return render_to_response('upload.html', locals(), context_instance=RequestContext(request))
but it doesn't work!I also include the right header in the form template and changed the directories in settings. I really can't sense the problem..as I say in my last reply, I include the multi part header and it doesn't work! :( What else I can try?
as I say in my last reply, I include the multi part header and it doesn't work! :( What else I can try?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/NpTYlQAR80sJ.
I have it like this, with filefield, in my first question I'm just posting the generated model from inspectdb and underneath I'm saying that I change it to FileField..
I have it like this, with filefield, in my first question I'm just posting the generated model from inspectdb and underneath I'm saying that I change it to FileField..
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/LYyL0YvwrVUJ.
I'm running it on the django development server. I changed the header and it behaves the same way. Is that expected or not?
I also triedprint request.FILES and I get<MultiValueDict: {}>, but after i tried print request.raw_post_data and it seems that the name of the file that i try to upload is included in the post data. I'm running out of other ideas!