def get(self, **kwargs): kwargs['user'] = User.get(kwargs['userid']) history = JobHistoryModel.all() history.filter("CreatedBy =", User.get(kwargs['userid'])) history.order("-Created").fetch(20); kwargs['history'] = history return self.render_response('adminuser.html', **kwargs)
def get(self): """Simply returns a rendered template with an enigmatic salutation.""" upload_url = blobstore.create_upload_url('/upload') auth_session = None if 'id' in self.auth_session: auth_session = self.auth_session template_values = { 'uploadurl' : upload_url, 'auth_session': auth_session, 'current_user': self.auth_current_user, 'login_url': self.auth_login_url(), 'logout_url': self.auth_logout_url(), 'current_url': self.request.url } if self.session.get('client') is not None: template_values['client'] = ClientModel.get(self.session.get('client')) history = JobHistoryModel.all() history.filter("Client =", ClientModel.get(self.session.get('client'))) history.order("-Created") history.fetch(100); template_values['history'] = history jobs = JobModel.all() jobs.filter("Client =", ClientModel.get(self.session.get('client'))) jobs.order("-Changed") jobs.fetch(100) template_values['jobs'] = jobs logging.log(logging.INFO, "client " + ClientModel.get(self.session.get('client')).Name + " has " + str(template_values['jobs'].count()) + " jobs") return self.render_response('clientlanding.html', **template_values)
def get(self, **kwargs): job = JobModel.get(kwargs['jobid']) output = StringIO.StringIO() z = zipfile.ZipFile(output,'w') history = JobHistoryModel.all() history.filter("Job = ", job) items = "" for item in history: username = item.CreatedBy.username items += item.Created.strftime("%b %d %Y - %I:%M%P") + "," + username +","+ item.Description+"\r\n" historycsv = StringIO.StringIO(items) z.writestr("history.csv", historycsv.read().encode('utf-8')) historycsv.close() communication = CommunicationModel.all() communication.filter("Job = ", job) items = "" for item in communication: username = item.CreatedBy.username items += item.Created.strftime("%b %d %Y - %I:%M%P") + "," + username +","+ item.Text+"\r\n" commcsv = StringIO.StringIO(items) z.writestr("communication.csv", commcsv.read().encode('utf-8')) commcsv.close() artifacts = job.Artifacts items = "" for item in artifacts: file = blobstore.get(item) items += file.filename+"\r\n" filescsv = StringIO.StringIO(items) z.writestr("files.csv", filescsv.read().encode('utf-8')) filescsv.close() items = "" items += "name, " + job.Nickname + "\r\n" items += "description, " + job.Description + "\r\n" items += "created, " + job.Created.strftime("%b %d %Y - %I:%M%P") + "\r\n" items += "created by, " + job.CreatedBy.username + "\r\n" items += "client, " + job.Client.Name + "\r\n" if job.Quote: items += "quote, " + job.Quote + "\r\n" datacsv = StringIO.StringIO(items) z.writestr("data.csv", datacsv.read().encode('utf-8')) datacsv.close() z.close() response = Response(output.getvalue()) response.headers["Content-Type"] = "multipart/x-zip" response.headers['Content-Disposition'] = "attachment; filename=" + job.JobNumber +".zip" return response
def get(self, **kwargs): auth_session = None if 'id' in self.auth_session: auth_session = self.auth_session template_values = { 'auth_session': auth_session, 'current_user': self.auth_current_user, 'login_url': self.auth_login_url(), 'logout_url': self.auth_logout_url(), 'current_url': self.request.url } try: if kwargs['view'] is not None: template_values['view'] = kwargs['view'] except: template_values['view'] = None if self.session.get('client') is not None: template_values['client'] = ClientModel.get( self.session.get('client')) history = JobHistoryModel.all() history.filter("Client =", ClientModel.get(self.session.get('client'))) history.order("-Created") history.fetch(100) template_values['history'] = history jobs = JobModel.all() jobs.filter("Client =", ClientModel.get(self.session.get('client'))) try: if kwargs['order']: jobs.order(kwargs['order']) else: jobs.order('OrderStage') except: jobs.order('OrderStage') template_values['jobs'] = jobs template_values['StatusInfo'] = { 'OrderStages': OrderStatus(), 'JobStages': JobStatus(), 'allOrderStages': lstOrderStages, 'allJobStages': lstJobStages } return self.render_response('clientlanding.html', **template_values)
def get(self, **kwargs): auth_session = None if 'id' in self.auth_session: auth_session = self.auth_session template_values = { 'auth_session': auth_session, 'current_user': self.auth_current_user, 'login_url': self.auth_login_url(), 'logout_url': self.auth_logout_url(), 'current_url': self.request.url } try: if kwargs['view'] is not None: template_values['view'] = kwargs['view'] except: template_values['view'] = None if self.session.get('client') is not None: template_values['client'] = ClientModel.get(self.session.get('client')) history = JobHistoryModel.all() history.filter("Client =", ClientModel.get(self.session.get('client'))) history.order("-Created") history.fetch(100); template_values['history'] = history jobs = JobModel.all() jobs.filter("Client =", ClientModel.get(self.session.get('client'))) try: if kwargs['order']: jobs.order(kwargs['order']) else: jobs.order('OrderStage') except: jobs.order('OrderStage') template_values['jobs'] = jobs template_values['StatusInfo'] = { 'OrderStages': OrderStatus(), 'JobStages' : JobStatus(), 'allOrderStages' : lstOrderStages, 'allJobStages' : lstJobStages } return self.render_response('clientlanding.html', **template_values)
def get(self, **kwargs): if str(self.auth_current_user.key()) == kwargs['userid'] or self.auth_current_user.is_admin or self.auth_current_user.is_staff: form = self.form user = User.get(kwargs['userid']) kwargs['user'] = user history = JobHistoryModel.all() history.filter("CreatedBy =", User.get(kwargs['userid'])) history.order("-Created").fetch(20); kwargs['history'] = history if user.assigned_to: kwargs['client'] = ClientModel.get(user.assigned_to) if user: obj = { 'username' : user.username, 'key' : str(user.key()), 'email' : user.email } logging.log(logging.INFO, 'editing user: '******'form'] = form return self.render_response('edituser.html', **kwargs) else: return self.redirect_to(url_for('account/login'))
def get(self, **kwargs): job = JobModel.get(kwargs['jobid']) blobstore.delete(job.Artifacts) job.Artifacts = [] history = JobHistoryModel.all() history.filter("Job = ", job) for item in history: logging.log(logging.INFO, "deleted %s" % item.key()) item.delete() communication = CommunicationModel.all() communication.filter("Job = ", job) for item in communication: logging.log(logging.INFO, "deleted %s" % item.key()) item.delete() job.delete() self.set_message('success', 'The job, files, and all related information were successfully cleared.', flash=True, life=5) return redirect_to('home')
def get(self): """Simply returns a rendered template with an enigmatic salutation.""" upload_url = blobstore.create_upload_url('/upload') auth_session = None if 'id' in self.auth_session: auth_session = self.auth_session template_values = { 'uploadurl': upload_url, 'auth_session': auth_session, 'current_user': self.auth_current_user, 'login_url': self.auth_login_url(), 'logout_url': self.auth_logout_url(), 'current_url': self.request.url } if self.session.get('client') is not None: template_values['client'] = ClientModel.get( self.session.get('client')) history = JobHistoryModel.all() history.filter("Client =", ClientModel.get(self.session.get('client'))) history.order("-Created") history.fetch(100) template_values['history'] = history jobs = JobModel.all() jobs.filter("Client =", ClientModel.get(self.session.get('client'))) jobs.order("-Changed") jobs.fetch(100) template_values['jobs'] = jobs logging.log( logging.INFO, "client " + ClientModel.get(self.session.get('client')).Name + " has " + str(template_values['jobs'].count()) + " jobs") return self.render_response('clientlanding.html', **template_values)
def get(self, **kwargs): if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff: return redirect(url_for('auth/login')) kwargs['client'] = ClientModel.get(kwargs['clientid']) # kwargs['history'] = db.Query("SELECT * FROM JobHistoryModel WHERE Client=:client ORDER BY Created LIMIT 30", client=ClientModel.get(kwargs['clientid'])) history = JobHistoryModel.all() history.filter("Client =", ClientModel.get(kwargs['clientid'])) history.order("-Created").fetch(200) kwargs['history'] = history kwargs['stages'] = lstStages kwargs['stagesEnum'] = Stages() jobs = JobModel.all() jobs.filter("Client =", ClientModel.get(kwargs['clientid'])) try: if kwargs['order']: jobs.order(kwargs['order']) else: jobs.order('Stage') except: jobs.order('Stage') kwargs['jobs'] = jobs return self.render_response('adminclient.html', **kwargs)
def get(self, **kwargs): if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff: return redirect(url_for('auth/login')) kwargs['history'] = JobHistoryModel.all().order('-Created').fetch(20) for h in kwargs['history']: h.Created = h.Created.replace(tzinfo=pytz.timezone('US/Eastern')).astimezone(timezone("US/Eastern")) kwargs['StatusInfo'] = { 'OrderStages': OrderStatus(), 'JobStages' : JobStatus(), 'allOrderStages' : lstOrderStages, 'allJobStages' : lstJobStages } jobs = JobModel.all() try: if kwargs['order']: jobs.order(kwargs['order']) else: jobs.order('OrderStage') except: jobs.order('OrderStage') try: if kwargs['clientid']: jobs.filter("Client = " , ClientModel.get(kwargs['clientid'])) except: pass kwargs['jobs'] = jobs kwargs['clients'] = ClientModel.all() for job in kwargs['jobs']: job.Created = job.Created.replace(tzinfo=pytz.timezone('US/Mountain')).astimezone(timezone("US/Mountain")) return self.render_response('admindashboard.html', **kwargs)
def getHistory(jobid): history = JobHistoryModel.all() history.filter("Job =", JobModel.get(jobid)) history.order("-Created") history.fetch(100); return history
def getHistory(jobid): history = JobHistoryModel.all() history.filter("Job =", JobModel.get(jobid)) history.order("-Created") history.fetch(100) return history