Could my problem be related to the fact that my views.py module first performs a get (sql select) on the table in question, and if the record is not there, then inserts it?
try: temp_ept_id = CsRemove.objects.get(endpointid=requested_serial_number) errors.append('Endpoint and channel already queued for removal.') except ObjectDoesNotExist: # element was not found - it is OK to add to cs_remove gd = createGlobalData(getMySQLDateTime()) base_date = gd.get_xfer_date_base() load_date = "'" + base_date + "'" try: inv_obj = \ CsRemove(action='R', \ endpointid=request.POST.get('inv_id'), \ devicetype=request.POST.get('ept_type'), \ channelnumber=request.POST.get('ept_ch'), \ actiondate=load_date) inv_obj.save(force_insert=True) errors.append('Endpoint ID queued for customer synch removal') except MySQLdb.Error, e: info_str = 'Error: ' + e + ' load_date = ' + load_date errors.append(info_str) On Mar 9, 8:37 am, octopusgrabbus <old_road_f...@verizon.net> wrote: > This is a MySQL 5.0+ database. I can manually insert using Query > Browser. > > On Mar 8, 12:34 pm, octopusgrabbus <old_road_f...@verizon.net> wrote: > > > Sorry. The error is Exception Type: > > ValidationError > > Exception Value: > > [u'Enter a valid date in YYYY-MM-DD format.'] > > > I have printed out for myself to prove that my date is in this format. > > > On Mar 8, 8:24 am, Jirka Vejrazka <jirka.vejra...@gmail.com> wrote:> Well, > > we're missing the bit where you tell us what error are you > > > getting. I don't know about others, but my crystal ball is a bit dusty > > > these days. > > > > The models.py snippet you posted is obvious result of inspectdb > > > output, which *may* need some manual tweaking. But it's difficult for > > > us to guess as we don't know your database and we don't know what > > > exactly is wrong (except for "Django fails"). > > > > If you add more details, someone might be able to help you > > > > My 2 cents > > > > Jirka > > > > On Tue, Mar 8, 2011 at 14:08, octopusgrabbus <old_road_f...@verizon.net> > > > wrote: > > > > Here is the table: > > > > > class CsRemove(models.Model): > > > > action = models.CharField(max_length=3, db_column='Action') # > > > > Field name made lowercase. > > > > endpointid = models.IntegerField(primary_key=True, > > > > db_column='EndpointId') # Field name made lowercase. > > > > devicetype = models.IntegerField(primary_key=True, > > > > db_column='DeviceType') # Field name made lowercase. > > > > channelnumber = models.IntegerField(primary_key=True, > > > > db_column='ChannelNumber') # Field name made lowercase. > > > > actiondate = models.DateField(primary_key=True, > > > > db_column='ActionDate') # Field name made lowercase. > > > > class Meta: > > > > db_table = u'cs_remove' > > > > > I can use MySQL Query browser and insert successfully. Django cannot. > > > > I can easily roll some MySQL code to do this, but would prefer to do > > > > it the Django way. > > > > > What am I missing? > > > > > Thanks. > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "Django users" group. > > > > To post to this group, send email to django-users@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > > django-users+unsubscr...@googlegroups.com. > > > > For more options, visit this group > > > > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.