On Mar 12, 6:50 pm, Omer Barlas <[email protected]> wrote:
> 1. I have this problem with DB records. I get the record from the DB like 
> this;
>
> def bolgeTextProcess(request, bolge, edit=None):
> [......]
>                 if not errors:
>                         try:
>                                 p = BolteText.objects.get(Id=edit)
>                         except:
>                                 p = BolgeText()
>                                 p.TarihYarat=date.today().isoformat()
>                                 p.Durum=0
> [.....]
>
> but when I save this instance it creates a new record instead of updating it.

You are always encountering an error, because you have written
"BolteText" rather than "BolgeText". This is why you should never use
a bare except clause - if you had used "except BolgeText.DoesNotExist"
you wouldn't have hidden your spelling error.

> 2. When I request the records from DB, I have to rewrite the default values
> one by one, doesn't django have a simple converter for this? All I want to
> do is something like;
>
> convertToDefaults(BolgeText.objects.get(Id=edit)

Sorry, not at all clear what you mean here. What would
'convertToDefaults' do? How do you need to rewrite default values?
--
DR.

-- 
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.

Reply via email to