Giter Club home page Giter Club logo

flask-appbuilder-site's Introduction

Hi there ๐Ÿ‘‹

Committer and PMC Member of Apache Superset

  • ๐Ÿซง Diving into music, code and underwater
  • ๐ŸŒฑ Nurturing plants and open source projects

Reach out:

flask-appbuilder-site's People

Contributors

dpgaspar avatar sodevious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flask-appbuilder-site's Issues

Department / Employee Log Model-View How To ?

Hi,

I am new to flask/flask-appbuilder and sqlalchemy.

I was looking at the employee sample and wanted to try implementing an employee log (clock-in time, comment) .

I want it so the logs can be displayed in the Department view as well as the employee view.
(view all logs for department ABC, view all logs for employee XYZ)

I don't want to use related_views.
I want the logs displayed in the regular listview. Without having to click on show for the show view.

eg: Department View
Department

department name here

Logs

department logs here

eg: Employee View
Employee

employee Name Here

Logs

employee logs here

How should you write the model for department, employee, and log. I'm not sure how to do the relationship part. I am a little inexperienced with using secondary, backref and primaryjoin.

How should you write the view ?

Heres a little code so you can look at what I'm doing

class Log(Model):
id = Column(Integer, primary_key=True)
department_id = Column(Integer, ForeignKey('department.id'), nullable=False)
department = relationship("Department")
employee_id = Column(Integer, ForeignKey("employee.id"), nullable=False)
employee = relationship("Employee")
comment = Column(String, default='OK', nullable=False)
date = Column(DateTime, default=func.now(), nullable=True)

class Department(Model):
id = Column(Integer, primary_key=True)
name = Column(String, unique = True, nullable=False)
def repr(self):
return self.name

class Employee(Model):
id = Column(Integer, primary_key=True)
name = Column(String, unique=True, nullable=False)
department_id = Column(Integer, ForeignKey('department.id'), nullable=False)
department = relationship("Department")

Any help is appreciated.

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.