def create_view(self, request, params): f = self.addform(request, data=params) if f.is_valid(): cd = f.cleaned_data name = cd.get('name') des = cd.get('description') nview = PortfolioView(code=name, name=name, description=des, user=request.user, fund=self.fund) nview.save() if cd.get('default', False): nview.set_as_default(request.user) cfrom = cd.get('copy_from', None) if cfrom: folders = cfrom.portfolio_set.filter(Q(parent__isnull=True)) for f in folders: f.copytoview(nview) dt = datetime.date.today() url = self.buildurl(dt, nview) return jredirect(url) else: return f.jerrors
def create_view(self, request, params): f = self.addform(request, data = params) if f.is_valid(): cd = f.cleaned_data name = cd.get('name') des = cd.get('description') nview = PortfolioView(code = name, name = name, description = des, user = request.user, fund = self.fund) nview.save() if cd.get('default',False): nview.set_as_default(request.user) cfrom = cd.get('copy_from',None) if cfrom: folders = cfrom.portfolio_set.filter(Q(parent__isnull=True)) for f in folders: f.copytoview(nview) dt = datetime.date.today() url = self.buildurl(dt,nview) return jredirect(url) else: return f.jerrors
def make_default_view(self): ''' Create a default view. This can be reimplemented by derived classes ''' try: user = User.objects.get(username=self.default_system_uder) except: raise Http404 view = PortfolioView(name=self.default_view_name, user=user, fund=self.fund, default=True) view.save() return view
def make_default_view(self): ''' Create a default view. This can be reimplemented by derived classes ''' try: user = User.objects.get(username = self.default_system_uder) except: raise Http404 view = PortfolioView(name = self.default_view_name, user = user, fund = self.fund, default = True) view.save() return view