Friday, June 29, 2018

Re: Django Admin

Teja,

First, let me suggest you just copy and paste your models from models.py. People who use Django a lot may find it easier to read the code (because they are familiar with the syntax and layout) than your typed summary of the classes.

Second, Django by itself cannot do what you want it to do. Django just makes html pages from the models, views, and templates you define, or are found in the admin classes. Once a page is displayed, that is what you get until the page is re-loaded from the server. What you are trying to do is have the page change without a round trip to the server. For that, you need some form of Javascript talking to the server as well. You can change the contents of an html page based on a selection in a select box using some Javascript to detect the change in the page and then talks to a Django view; the view in Django gets the data you want from the database and returns that data to the script, which updates the html page; and an appropriate url for the script to talk to the view and for the view to listen to. That is just one way to accomplish what you want to do. There are also add-on django projectst that will do this for you. Google for django smart selects, django autocomplete, django ajax, and this page of projects - https://djangopackages.org/grids/g/auto-complete/.

Good luck!

Mark

On Fri, Jun 29, 2018 at 7:27 AM, Teja Yerraballe <teja.yerraballe@aspiresys.com> wrote:

Hi Team,


I have created 4 models ( class Company, class Department, class Section, class Employee )


Company Model has : CMP1, CMP2, CMP3, CMP4, CMP5(Year is the foreign key in this model)


Department Model has : DEP1, DEP2,DEP3,DEP4,DEP5 (Company is the foreign key in this model)


Section Model has : SEC1, SEC2,SEC3,SEC4,SEC5 (Department is the foreign key in this model)


Employee Model has : EMP1,EMP2,EMP3,EMP4,EMP5 (Section is the foreign key in this model)



Now I have created 2 more models (class Details, Class Map)


Details Model Fields:


salary


Map Model Fields


Company ( foreign key Company Model)

Department (foreign key Department Model )

Section (foreign key section Model)

Employee (foreign key employee Model)


Details Model will Map salary for the employees


I need to show these two models in admin page ( class Map as the inline model for class Details)


=================================================================================

ADMIN PAGE looks as below :


Details 


select salary range

 (drop down)


MAP [ inline Model ] : Need to Map employees who come under the salary range


  1.  select Company      select Department        select Section       select Employee

           (drop down)              (drop down)                   (drop down)           (drop down)

     2. select Company      select Department        select Section       select Employee

           (drop down)              (drop down)                   (drop down)           (drop down)

     3select Company      select Department        select Section       select Employee

           (drop down)              (drop down)                   (drop down)           (drop down)


======================================================================================


=> On selecting a company, we should display only departments in that company.

=> On selecting Department, we should display only sections in that Department.

=> On selecting Section, we should display only employees in that Section.

 


I am messed with this implementation, Please help me out in this. If possible please brief me the steps to follow on this implementation


Thanks in Advance


Regards,


Teja Y

LAMP





Aspire Systems

This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain proprietary, confidential, trade secret or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/SG2PR02MB3532FF8BEF86B8796A035268FF4E0%40SG2PR02MB3532.apcprd02.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEqej2MedgiOTf6uExRKEVzyLNcMU1q_xjCWAw79sr-bDyZo9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment