Hello,
I am having an odd issue updating a table (I don't have this issue on
any other table)... When I update the value it gets wrapped in
('NEW_VALUE',) when it should just be NEW_VALUE.
Current Value in DB Desired New Value -- Before Saving
Perez Perez
Current Value in DB Desired New Value -- After Saving
('Perez',) Perez
Here is the code:
*** DOESN'T WORK ***
def updateYouth(youth,line):
print "Current Value\tNew Value -- Before Saving\n{0:16}
{1:16}".format(youth.name_last, line['Youth - Last
Name'].title().strip())
if len(line['Youth - First Name']) > 0:
youth.name_first=line['Youth - First Name'].title().strip(),
if len(line['Youth - Middle Name']) > 0:
youth.name_middle=line['Youth - Middle Name'].title().strip(),
if len(line['Youth - Last Name']) > 0: youth.name_last=line['Youth
- Last Name'].title().strip(),
youth.save()
print "Current Value\tNew Value -- After Saving\n{0:16}
{1:16}".format(youth.name_last, line['Youth - Last
Name'].title().strip())
......
name_first = models.CharField(max_length=255, verbose_name="First
Name")
name_middle = models.CharField(max_length=255, blank=True,
verbose_name="Middle Name")
name_last = models.CharField(max_length=255, verbose_name="Last
Name")
.....
*** DOES WORK ***
def updateParent(parent,which,line):
if len(line['Parent '+which+' - First Name']) > 0:
parent.name_first=line['Parent '+which+' - First
Name'].title().strip()
if len(line['Parent '+which+' - Middle Name']) > 0:
parent.name_middle=line['Parent '+which+' - Middle
Name'].title().strip()
if len(line['Parent '+which+' - Last Name']) > 0:
parent.name_last=line['Parent '+which+' - Last Name'].title().strip()
.....
name_first = models.CharField(max_length=255, verbose_name="First
Name")
name_middle = models.CharField(max_length=255, blank=True,
verbose_name="Middle Name")
name_last = models.CharField(max_length=255, verbose_name="Last
name")
.....
Any Ideas?
Thanks,
Michael
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.