Coder Social home page Coder Social logo

django-rest-framework-filter's Introduction

功能

配合Django-Rest-Framework框架使用, 拦截地方在关键函数get_query(), 进行调用

使用

可进行前段自定义字段传入, 后端进行一对一匹配字段进行渲染匹配

views.py

from filter import Filter 

def get_queryset(self):
	filter_instance = Filter(
		request=self.request, model=models.FaultType,
		name='name__contains')
	return filter_instance.filter('-id')

Filter里面除了model和request是固定语法外, 其余均是请求的参数, key为参数,value为具体渲染的Django Field

django-rest-framework-filter's People

Contributors

yuzongyanghi avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.