def get(self, request, parcel=None): config = RequestConfig(request) parcelDoesNotExist = False if parcel: parcelNumber = parcel form = NeighborhoodAssocationSearchForm(request.GET) try: selected_property = Property.objects.get(parcel=parcelNumber) na = Neighborhood_Association.objects.filter( geometry__contains=selected_property.geometry).order_by('area2') except Property.DoesNotExist: na = Neighborhood_Association.objects.all().order_by('name') parcelDoesNotExist = True else: form = NeighborhoodAssocationSearchForm() na = Neighborhood_Association.objects.all().order_by('name') parcelNumber = '' naTable = NeighborhoodAssociationTable(na, prefix="na-") config.configure(naTable) return render_to_response('neighborhood_associations.html', { 'form': form, 'title': parcelNumber, 'table': naTable, 'parcelDoesNotExist': parcelDoesNotExist }, context_instance=RequestContext(request))
def get(self, request, parcel=None): config = RequestConfig(request) parcelDoesNotExist = False if parcel: parcelNumber = parcel form = NeighborhoodAssocationSearchForm(request.GET) try: selected_property = Property.objects.get(parcel=parcelNumber) na = Neighborhood_Association.objects.filter( geometry__contains=selected_property.geometry).order_by( 'area2') except Property.DoesNotExist: na = Neighborhood_Association.objects.all().order_by('name') parcelDoesNotExist = True else: form = NeighborhoodAssocationSearchForm() na = Neighborhood_Association.objects.all().order_by('name') parcelNumber = '' naTable = NeighborhoodAssociationTable(na, prefix="na-") config.configure(naTable) return render_to_response('neighborhood_associations.html', { 'form': form, 'title': parcelNumber, 'table': naTable, 'parcelDoesNotExist': parcelDoesNotExist }, context_instance=RequestContext(request))
def showApplications(request): config = RequestConfig(request) soldProperties = Property.objects.all().filter(status__exact='Sold').order_by('status', 'applicant') approvedProperties = Property.objects.all().filter(status__istartswith='Sale').order_by('status', 'applicant') soldTable = PropertyStatusTable(soldProperties, prefix="1-") approvedTable = PropertyStatusTable(approvedProperties, prefix="2-") config.configure(soldTable) config.configure(approvedTable) return render(request, 'renew/app_status_template.html', {'soldTable': soldTable, 'approvedTable': approvedTable, 'title': 'applications & sale activity'})
def showAnnualReportIndex(request): config = RequestConfig(request) f = AnnualReportFilters( request.GET, queryset=annual_report.objects.all().order_by('id')) table = AnnualReportTable(f) config.configure(table) return render_to_response('admin-with-filter-table.html', { 'filter': f, 'title': 'Annual Report Admin', 'table': table }, context_instance=RequestContext(request))
def condition_report_list(request): config = RequestConfig(request) f = ConditionReportFilters( request.GET, queryset=ConditionReport.objects.all().order_by('-timestamp')) table = ConditionReportTable(f) config.configure(table) return render_to_response('admin-with-filter-table.html', { 'filter': f, 'title': 'Condition Reports Admin', 'table': table }, context_instance=RequestContext(request))
def inquiry_list(request): config = RequestConfig(request) f = PropertyInquiryFilters( request.GET, queryset=propertyInquiry.objects.all().order_by('-timestamp')) table = PropertyInquiryTable(f) config.configure(table) return render_to_response('admin-with-filter-table.html', { 'filter': f, 'title': 'Property Inquiry Admin', 'table': table }, context_instance=RequestContext(request))
def showAnnualReportIndex(request): config = RequestConfig(request) f = AnnualReportFilters( request.GET, queryset=annual_report.objects.all().order_by('id')) table = AnnualReportTable(f) config.configure(table) return render_to_response('admin-with-filter-table.html', { 'filter': f, 'title': 'Annual Report Admin', 'table': table }, context_instance=RequestContext(request))
def getProjectDepHistory(request): project_name=request.GET["project"] details=False text=text="<a href='?project="+project_name+"&details=True'>Show all deployment history</a>" if "details" in request.GET: if request.GET["details"]=="True": details=True text="<a href='?project="+project_name+"'>Show latest updates</a>" deployments=Deployment_Server.objects.filter(project__name=project_name).order_by("-datetime") res=[] servers=[] for deployment in deployments: if not details and deployment.server.name in servers: continue servers.append(deployment.server.name) c = Client(deployment.project.repo_type, deployment.server.ip, deployment.server.port) if deployment.update_type == "commit": commits=c.getCommitsDiff(deployment.project.working_dir,deployment.update_version) print commits deployment.has_new_version = len(commits) print deployment.server,deployment.has_new_version res.append(deployment) table=DeploymentHistory(res) RequestConfigReport(request, paginate={"per_page": 15}).configure(table) return render_to_response("modify.html",{"table":table,"name": "Deployments for %s"%project_name,"text":text},context_instance=RequestContext(request))
def manage_servers(request): name = "Servers" xlstable = ServersReport(Server.objects.all()) table_to_report = RequestConfigReport(request, paginate={"per_page": 15}).configure(xlstable) if table_to_report: return create_report_http_response(table_to_report, request) return render_to_response("modify.html", {"name": name, "table": xlstable}, context_instance=RequestContext(request))
def get_table(self, queryset, downloadable=False): """Convert the queryset to a report table.""" if not getattr(self, 'table_class', None): raise ImproperlyConfigured("Report class must define `table_class`") data = self.get_table_data(queryset) if downloadable: downloadable_class = getattr(self, 'downloadable_table_class', self.table_class) table = downloadable_class( data, empty_text=self.empty_text, attrs=self.attrs ) else: table = self.table_class(data, empty_text=self.empty_text, attrs=self.attrs) config = RequestConfig(self.request, paginate={ 'per_page': self.page_size, }) config.configure(table) return table
def showApplications(request): config = RequestConfig(request) soldProperties = Property.objects.all().filter( status__istartswith='Sold').order_by('status', 'applicant') approvedProperties = Property.objects.all().filter( status__istartswith='Sale').order_by('status', 'applicant') soldFilter = ApplicationStatusFilters( request.GET, queryset=soldProperties, prefix="sold-") approvedFilter = ApplicationStatusFilters( request.GET, queryset=approvedProperties, prefix="approved-") soldTable = PropertyStatusTable(soldFilter, prefix="sold-") approvedTable = PropertyStatusTable(approvedFilter, prefix="approved-") config.configure(soldTable) config.configure(approvedTable) return render(request, 'app_status_template.html', {'soldTable': soldTable, 'approvedTable': approvedTable, 'title': 'applications & sale activity', 'soldFilter': soldFilter, 'approvedFilter': approvedFilter})
def projects(request): name = "Projects" if request.user.is_superuser: xlstable = ProjectReport(Project.objects.all()) else: projects = User_Project.objects.filter(user_id=request.user.id).values_list('project',flat=True) xlstable = ProjectReport(Project.objects.filter(name__in=list(projects))) table_to_report = RequestConfigReport(request, paginate={"per_page": 15}).configure(xlstable) if table_to_report: return create_report_http_response(table_to_report, request) return render_to_response("modify.html", {"name": name, "table": xlstable}, context_instance=RequestContext(request))
def get_table(self): """ Return a table object to use. The table has automatic support for sorting and pagination. """ options = {} table_class = self.get_table_class() table = table_class(self.get_table_data()) paginate = self.get_table_pagination() if paginate is not None: options['paginate'] = paginate self.table_to_report = RequestConfigReport(self.request, **options).configure(table) return table
def get_table(self, queryset, downloadable=False): """Convert the queryset to a report table.""" if not getattr(self, 'table_class', None): raise ImproperlyConfigured( "Report class must define `table_class`") data = self.get_table_data(queryset) if downloadable: downloadable_class = getattr(self, 'downloadable_table_class', self.table_class) table = downloadable_class(data, empty_text=self.empty_text, attrs=self.attrs) else: table = self.table_class(data, empty_text=self.empty_text, attrs=self.attrs) config = RequestConfig(self.request, paginate={ 'per_page': self.page_size, }) config.configure(table) return table
def get_table(self, **kwargs): """ Return a table object to use. The table has automatic support for sorting and pagination. """ options = {} table_class = self.get_table_class() table = table_class(self.get_table_data(), **kwargs) args = () if django.VERSION >= (1,8,0): args = (table, ) paginate = self.get_table_pagination(*args) if paginate is not None: options['paginate'] = paginate self.table_to_report = RequestConfigReport(self.request, **options).configure(table) return table