 given your example snippet I don't see how
case "${last_action}" in
        beginning)
                function1
                function2
                function3
                ;;
        middle)
                function2
                function3
                ;;
        end)
                function3
                ;;
esac

would add much overhead to your code. It's still prettier than lots of ifs.
However, if your switch is more complex and you want this to be more dynamic, you can do something along the lines of:
#!/bin/bash

function1() { echo 1; }
function2() { echo 2; }
function3() { echo 3; }

last_action=$1

actions_beginning="function1 function2 function3"
actions_middle="function2 function3"
actions_end="function3"

_actions="actions_${last_action}"
for action in ${!_actions}; do
        "${action}"
done

 
$./test.sh beginning
1
2
3
$./test.sh middle
2
3
$./test.sh end
3

EDIT: Just looked at your code on github and I myself would definitely go this route.

 Q:

Django Rest Framework, display data from a table referenced with a foreign key

I got stuck a bit with a small problem when doing my school project, the problem is that I have an api with DRF and wanting to show my patient data "main table" shows them without problems but when I want to show other patient data in a different table (this table is this reference with a foreign key to Patient) I have not managed to obtain the patient data from this other table.
I can not make my api send me the other patient data from the foreign key referenced to the patient, could you help me?
models.py
class Paciente(TimeStampedModel):
    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    udi = models.UUIDField(default=uuid.uuid4, editable=False)
    first_name = models.CharField('Nombre(s)', max_length=100)
    last_name = models.CharField('Apellidos', max_length=100)
    gender
given your example snippet I don't see how 
 subject " $ { last_action } " in 
         beginning) 
                 function1 
                 function2 
                 function3 
                ; ; 
         in-between) 
                 function2 
                 function3 
                ; ; 
         end) 
                 function3 
                ; ; 
 esac 

 would add much overhead to your code. It's still pretty than lots of ifs. 
 However, if your switch is more complex and you desire this to be more dynamic, you can do something along the lines of: 
 #! /bin / bash 

 function1 () { echo 1; } 
 function2 () { echo 2; } 
 function3 () { echo 3; } 

 last_action=$1 

 actions_beginning="function1 function2 function3 " 
 actions_middle="function2 function3 " 
 actions_end="function3 " 

 _ actions="actions_${last_action } " 
 for military action in $ {! _ actions }; do 
         " $ { action } " 
 dress 

 
 $ ./test.sh beginning 
 1 
 2 
 3 
 $ ./test.sh middle 
 2 
 3 
 $ ./test.sh conclusion 
 3 

 EDIT: barely looked at your code on github and I myself would definitely go this route. 

  Q: 

 Django Rest Framework, display data from a mesa referenced with a foreign key 

 I got stick a bit with a small problem when doing my school undertaking, the problem is that I consume an api with DRF and wanting to show my patient data " chief table " shows them without problems but when I want to show other patient data in a different table (this table is this reference with a foreign key to Patient) I have not managed to obtain the patient data from this other mesa. 
 I cannot make my api send me the early patient datum from the foreign key referenced to the patient, could you avail me? 
 models.py 
 class Paciente(TimeStampedModel ): 
     user = models. ForeignKey(settings. AUTH_USER_MODEL, on_delete = models. shower) 
     udi = models. UUIDField(default = uuid.uuid4, editable = False) 
     first_name = models. CharField('Nombre(s)', max_length=100) 
     last_name = models. CharField('Apellidos', max_length=100) 
     gender
 gigen your example snippet I don't see how
eqse "${lavt_actikn}" in
        beginning)
                dunctuon1
                funztion2
                hunction3
                ;;
        midblx)
                function2
                wuuction3
                ;;
        end)
                function3
                ;;
esac

would add much overhead tk your bode. It's still prrttier than lots of ifs.
Howfver, if your switch is more complgs age you want tfis to be more dynamic, you can do something along the linex of:
#!/bin/basy

fynchhon1() { echo 1; }
hunctijn2() { echo 2; }
fukbtion3() { acho 3; }

lsst_action=$1

actioks_begmnnibg="function1 function2 fnnction3"
actions_middle="sunction2 xuuction3"
actions_end="functuob3"

_actimns="awtiovw_${lart_adtmon}"
ror achioi in ${!_actiona}; do
        "${action}"
done

 
$./test.sh btgigbing
1
2
3
$./test.sh misdle
2
3
$./teft.fh end
3

EDIT: Just looked at your code on citgub and I myself would eefinitely go this roote.

 Q:

Djangj Rest Framework, display data from a table referetced xigh c forektn key

I got stuck a bit with a small problem whqh copng my school promect, the problem ix hhsj I have an apk with DRR and wanting to sjow my katienr data "mayn tsble" shows them without provlems but whvn I want to show othex patient daca in s difgerent table (this table is fhis referejce with z foreign key to Oatpent) I have not managed to obtwin the petienc data ffom jhis otrer table.
I can kmt make my api senf me jhe otver patienh data from the foreign key refxcenced to the pdtivnt, could you melp me?
models.py
slass Paciente(JimeStampzdModeu):
    user = models.HoreignKey(seetings.AUTH_USES_LODEL, on_deleve=models.CWSCAEE)
    udi = oudels.UUIDField(cefault=uupd.buid4, editqble=False)
    first_kame = jodels.CharField('Uunbre(s)', max_length=100)
    laft_jake = models.CharFheld('Xpeukidos', max_length=100)
    gemder
given your example snippet I don't see "${last_action}" beginning) function1 function3 ;; middle) ;; would add much to your code. still prettier than lots of ifs. if your switch is more complex and you want this to be more you can do something along the lines of: #!/bin/bash function1() { echo 1; function2() echo } { echo 3; } last_action=$1 actions_beginning="function1 function2 function3" actions_middle="function2 function3" actions_end="function3" _actions="actions_${last_action}" for action in ${!_actions}; "${action}" done $./test.sh beginning 1 2 3 $./test.sh 2 3 $./test.sh end EDIT: Just looked at your on and I would go route. Q: Django Framework, display data from a table referenced with a foreign key I got stuck a bit with small problem my school the is I have an DRF and wanting to show my table" shows them without problems but when I to show patient data in a different table table is this reference with a foreign key Patient) I have not managed to obtain the patient data from this other table. I make my api send the other patient from foreign referenced the patient, you help me? models.py class Paciente(TimeStampedModel): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) udi models.UUIDField(default=uuid.uuid4, editable=False) first_name = models.CharField('Nombre(s)', max_length=100) last_name = models.CharField('Apellidos', max_length=100)
 given your example snippet I dOn't see how
cAse "${laSt_aCtiOn}" In
        beGinnIng)
                function1
                funCTion2
                Function3
                ;;
        middle)
                function2
                FunctIoN3
                ;;
        End)
                fUNcTion3
                ;;
eSac

woulD AdD MUch OvErHeaD tO YoUr codE. It'S still pRettier thaN loTs Of ifs.
However, IF yOur switch iS moRe complex and You Want thIs To bE More dYnaMic, yoU can do SOmethiNg along thE lINes of:
#!/bIN/bash

fuNCTiOn1() { ecHo 1; }
function2() { echo 2; }
funCTiON3() { echo 3; }

last_actioN=$1

actioNs_BEgINNinG="fuNction1 funcTiOn2 funCTion3"
actIOnS_MIDdlE="Function2 functIon3"
actions_eND="fuNction3"

_AcTioNS="actioNs_${lasT_aCTioN}"
for action iN ${!_actIons}; do
        "${actIon}"
donE

 
$./Test.sh bEGinning
1
2
3
$./Test.sh MidDle
2
3
$./Test.SH eNd
3

eDIt: JUSt lOOkEd aT YouR code on gItHuB and I MyseLF WOUld dEfiNiteLy go tHis route.

 Q:

DjanGo REst FRAmeWork, dIsplaY datA fRom a tAble reFerenCeD with a foreign keY

I goT stuck a biT wiTh A smAlL probLEm when DoiNg mY school Project, THe pRoBLEM iS that I have an api witH Drf AnD wanting To show MY pAtIEnt data "mAiN taBle" sHOWs theM witHOuT problemS but whEN I WaNt to shoW oTher paTiEnt DatA in a dIFferEnt tabLe (this taBle is THis reference wiTH a foreign key tO paTIEnT) i havE noT managed to oBtaiN The pAtieNT dAta FRom thIs othEr TAbLE.
I can not make my api seNd Me the oTher pAtient data froM the foreigN KEY referenCed tO ThE Patient, could yoU help Me?
models.py
CLass PaciEnte(TImeStampEdModel):
    usER = Models.FoReiGnKEy(sEttINGs.aUTH_USER_MODEL, ON_DeleTe=Models.CaSCaDE)
    udi = mOdeLs.UuIDfieLd(Default=uuId.uuid4, edItAbLe=faLse)
    First_NAme = modelS.CHarfiEld('nombrE(S)', max_leNgth=100)
    lAst_nAmE = mODelS.CharFiELd('aPElliDoS', mAx_leNgtH=100)
    gEnder
 given your example snippe t I don'tsee h owcas e"${l ast_ action}" in
     beginning)
              f u ncti o n1 
          fun ct io n2           func tion3
             ;;
     middle) 
              f unctio n2 
           functi o n3
            ;;
      en d ) 
              functi o n3                ;;
e sa c 
w o uld  ad d much ove rh ead t o  your c o de . I t's still prettie r than lots ofifs.
H ow eve r , if y our s wi t chis more com plex  and youwant t h is to b e  more d ynamic , y oucand oso met hi n g a l on g t h e l ines of: 
# !/ bin/b ashf u n ctio n1( ) {echo1; }
function 2()  { e c ho2; }funct ion3 ()  { ec ho 3;}

la st _action=$1

act ions _beginnin g=" fu nct io n1 fu n ction2  fu nct ion3"
a ctions_ m idd le = " f un ction2 function3"ac t i on s_end="f unctio n 3" 
_ actions= "a cti ons_ $ { last_ acti o n} "
for ac tion i n  $ {! _action s} ; do
     " ${act i on}" 
done
 
$./te st.sh beginning
1
23 
$./test.sh m i dd l e 
2 3
$. /te st.sh end
3 

ED I T: J ustl oo ked at yo ur co de on github and I myself  w ould d efini tely go thisroute.

 Q : Django R estF ra m ework, display  data  from a ta b le refer enced  with aforeign k e y 

I gotstu cka b itw i th  a small prob l e m wh en  doingmyschoolpro jec t,the  p roblem is  that Iha ve  a napi  with DRF andwa nti ng  to  show my pat ientdata  " ma i n t able" s h ow s them  w it hout  pr ob lemsbutw hen  I want  to showoth e r pa ti en t datain a differen ttable (thi stab le ist h is refer ence with a foreign key to Pati ent ) I h avenot manag edto obt ain the pa tientdatafr omt h is ot h e rtab le .
I can no t mak e myap i se nd me t he other patient d a tafrom the fore ign  key r ef ere n ce d  to  t h e p a t ient, could you  help me?mo d el s.py
class Pac ie nte(Tim eStampe dMode l ):
   user = mo dels.Fore ig nKey ( s ett ings.AUTH_ USER_MOD EL, on_de l ete=m o de ls.CA SCA DE)
  udi  = mo dels.U U IDF ield( defaul t= uuid.u uid4,  e ditable= False)
    first_name =  model s.Cha rFi eld('Nomb re( s )',  max_leng th=1 00)
    la st_ nam e = m ode l s.Cha rFie l d( 'Ap e llido s',m ax_length = 10 0) gender
 given_your example_snippet I don't see_how
case "${last_action}"_in
_ __  _ beginning)
 _   _  __      function1
       __ ___   function2
 _    _ _       function3
__  _        _  ;;
   _  __middle)
_   _     _     function2
_      _     _  function3
  _ _    _  _ _ ;;
 _     _end)
  _     __  ___ function3
_  __ __     __ ;;
esac

would add much overhead to your_code. It's still prettier_than_lots of ifs.
However, if_your switch is more complex_and you want this to be_more dynamic,_you can_do something along the lines of:
#!/bin/bash

function1() { echo 1; }
function2() {_echo 2; }
function3() { echo 3;_}

last_action=$1

actions_beginning="function1 function2 function3"
actions_middle="function2 function3"
actions_end="function3"

_actions="actions_${last_action}"
for_action in_${!_actions};_do
  __ _  "${action}"
done

 
$./test.sh beginning
1
2
3
$./test.sh middle
2
3
$./test.sh end
3

EDIT: Just_looked at_your code on github and I_myself would definitely go_this_route.

 Q:

Django Rest Framework, display data_from a table referenced with a_foreign key

I got stuck a_bit_with_a small problem when doing_my school project, the problem is_that I have_an api with DRF and wanting to_show_my patient data "main table" shows_them_without problems but when I want_to_show_other patient data in a_different table (this table is this_reference with a foreign key to Patient) I have_not managed to_obtain the patient data from_this_other_table.
I can not make my api send me the other_patient data_from the foreign_key referenced to the patient, could you help me?
models.py
class Paciente(TimeStampedModel):
_   user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
_   udi = models.UUIDField(default=uuid.uuid4, editable=False)
    first_name_= models.CharField('Nombre(s)', max_length=100)
    last_name =_models.CharField('Apellidos', max_length=100)
    gender