Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

python - How to override save() method of modelform class and added missing information? -


i started learn django , had question.

i'm trying automatically add missing information, when saving form data. change/add desired "cleaned_data" information overriding save() method of modelform class, changes not recorded in database. actually, how write modified information? code:

def save(self, commit = true, *args, **kwargs):     temp = servicemethods(url = self.cleaned_data.get('url'), wsdl_url = self.cleaned_data.get('wsdl_url'))      if not temp.get_wsdl_url():                                      temp.make_wsdl_url()      if temp.get_wsdl_url():                                          temp.make_wsdl()                                             self.cleaned_data['wsdl_url'] = temp.get_wsdl_url()          self.cleaned_data['wsdl_description'] = temp.get_wsdl_description()      super(serviceform, self).save(commit = commit, *args, **kwargs)   

and model:

class services(models.model):     name                = models.charfield('Имя', max_length=256)     url                 = models.urlfield('Ссылка', unique = true)     wsdl_url            = models.urlfield('Ссылка на wsdl-документ', blank=true)     description         = models.textfield('Описание сервиса',blank=true)     wsdl_description    = models.textfield('wsdl описание', blank=true, editable=false)     added               = models.datetimefield('Добавлено', auto_now_add=true) 

tia

try setting data on self.instance instead of in self.cleaned_data, , let me know if works.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -