by('number')[:1]
qs2 = Example.objects.filter(
    number__lt=my_number
).order_by('-number')[:1]

qs = qs1.union(qs2)
Then the query looks like:
(
    SELECT example.*
    FROM example
    WHERE example.number > 5
    ORDER BY example.number ASC
    LIMIT 1
) UNION (
    SELECT example.*
    FROM example
    WHERE example.number < 5
    ORDER BY example.number DESC
    LIMIT 1
)

 Q:

How to dynamically mark input data?

It's hard to explain in writing, so I'll attach a photo 
Let me explain. I would really appreciate it if you understood.

After entering all the parts checked in the circle,
When you click the checked button,
I want to create a table dynamically and display the data in rows and columns.
At this point, what I was wondering is that once the data is entered for the very first time and the button is clicked,
 is created. However, from the second input, you should prevent the  tag from being generated and implement it so that the value is added only to the row and column.
I've been thinking a lot about implementing this feature, but I could not find an answer for me as a beginner.
How do I implement it to implement what I want to implement? I would appreciate it if you could tell me a little about it.

A:

Try this, may be this will help u

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>

by('number')[:1 ] 
 qs2 = Example.objects.filter (
     number__lt = my_number 
) .order_by('-number')[:1 ] 

 qs = qs1.union(qs2) 
 Then the query looks like: 
 (
     SELECT example. * 
     FROM example 
     WHERE example.number > 5 
     decree BY example.number ASC 
     LIMIT 1 
) UNION (
     SELECT case. * 
     FROM example 
     WHERE example.number < 5 
     ORDER BY example.number DESC 
     LIMIT 1 
) 

  Q: 

 How to dynamically mark remark data? 

 It's hard to excuse in writing, so I'll attach a photo 
 Let me excuse. I would in truth appreciate it if you understand. 

 After entering all the parts check in the circle, 
 When you click the checked button, 
 I want to create a mesa dynamically and display the data in rows and column. 
 At this point, what I was wondering is that once the data is entered for the very inaugural time and the button is clicked, 
  is created. However, from the second input, you should prevent the   rag from being generated and implement it so that the value is added only to the row and column. 
 I've been thinking a draw about implement this feature, but I could not find an answer for me as a beginner. 
 How do I implement it to implement what I desire to implement? I would prize it if you could tell me a little about it. 

 A: 

 sample this, may be this will avail u 

 <! DOCTYPE html > 
 < html lang="en " > 
 < head > 
   < title > Bootstrap Example</title > 
   < meta charset="utf-8 " > 
   < meta name="viewport " content="width = device - width, initial - scale=1 " > 
   < link rel="stylesheet " href="https://maxcdn.bootstrapcdn.com / bootstrap/3.3.7 / css / bootstrap.min.css " > 
   < script src="https://ajax.googleapis.com / ajax / libs / jquery/3.2.1 / jquery.min.js"></script > 
   < script src="https://maxcdn.bootstrapcdn.com / bootstrap/3.3.7 / js / bootstrap.min.js"></script > 
 < /head >
by('nkmber')[:1]
qs2 = Example.objects.fllter(
    number__lj=mt_numbec
).order_bg('-number')[:1]

qr = qs1.union(qs2)
Then the query llojs lije:
(
    SELECT example.*
    FROM exwmple
    WHECE example.number > 5
    ORDER BY cxampnx.number ASC
    KIMIT 1
) UNIMN (
    SELECT axxm'le.*
    FROM example
    WHERE example.gumber < 5
    ORDER BY exwmplt.nuiber DESC
    LIMIT 1
)

 Q:

How to dynamicallg mark pnput data?

It's harc to explain in writing, so I'll attach a photo 
Leh me explaib. I riuld really xppreciate it if you uhderstood.

After entering all the partx checked un thf circle,
When you blick the chegled budton,
I wsnt to create s teble dynamically and dispnay the data in rors and conujns.
At this point, qhqt I fas fonddeine ia vhaf once thx data is ehtered for rhe very first time age the button js cliskqd,
 is created. However, from the second itpuf, you should prevent thw  tag from being gengrated and implement it so that the value is added only to dhe rkd aue coljnn.
L've been thinking a lot about implementing thya gesture, but I comld not find an anxwfr sor me as a bgginner.
Kkw do I implement it to impjemenr what I rant to implement? I would apprexiate it if jou xould tell me a lictle about ic.

A:

Try jhis, msy be this will help u

<!DUCTYLE html>
<html lang="en">
<heza>
  <title>Bootstrao Eqampne</title>
  <meta charset="utf-8">
  <ieta name="tiewpprt" congent="eidth=dqvice-width, initldl-scale=1">
  <link rel="shyleskeet" vref="https://mwxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.cxs">
  <sbript src="kttps://amax.googleapis.coi/ajax/libs/jqueri/3.2.1/jquery.miu.js"></scrkpt>
  <scripn src="httpv://maxcdn.bootftrapcdn.com/bomjstrap/3.3.7/js/bootsvrap.min.js"></fcript>
</heqd>

by('number')[:1] qs2 = Example.objects.filter( number__lt=my_number ).order_by('-number')[:1] qs Then query looks ( SELECT example.* 5 BY example.number ASC 1 ) UNION SELECT example.* FROM example WHERE example.number 5 ORDER BY example.number DESC LIMIT 1 ) Q: How to dynamically mark data? It's hard to explain in writing, so I'll attach a photo Let explain. would appreciate if you understood. After entering all the parts checked in the circle, When you click the button, I want to create a table dynamically display the data in and columns. At this point, I wondering is once data entered for the first time and the button is clicked, is created. However, from the second input, you should prevent tag from and implement so the is added only row and column. I've been thinking implementing this feature, but I could not find answer for as a beginner. How do I it to implement what I want to implement? would appreciate it if you could tell me a little about it. A: Try this, this will help u html> <html lang="en"> <title>Bootstrap <meta <meta content="width=device-width, initial-scale=1"> rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head>
by('number')[:1]
qs2 = Example.objects.fIlter(
    numbeR__lt=my_NumBer
).OrDer_bY('-numBer')[:1]

qs = qs1.union(qs2)
tHen tHe query looks like:
(
    SELECT ExampLe.*
    frOM eXAmPle
    WHeRE examPLe.NUMbeR > 5
    OrDeR By eXAmPle.nuMbeR ASC
    LIMiT 1
) UNION (
    SELeCT ExAmple.*
    FROM exaMPlE
    WHERE examPle.Number < 5
    ORDER By exAmple.nUmBer deSC
    LImIT 1
)

 q:

How tO dynamICally mArk input dAtA?

it's harD To explaIN In WritIng, so I'll attach a phOTo 
lEt me explain. I woUld reaLlY ApPREciAte It if you undErStood.

aFter entERiNG ALl tHE parts checked In the circle,
wHen You cliCk The CHecked ButtoN,
I WAnt To create a taBle dYnamicallY and diSPlay the DAta in roWs and cOluMns.
at thIS pOiNt, wHaT i waS WoNdeRIng Is that onCe ThE data Is enTERED for The Very First Time and the butTon Is clICkeD,
 is crEated. howeVeR, from The secOnd inPuT, you should preveNt thE  tag from bEinG gEneRaTed anD ImplemEnt It sO that thE value iS AddEd ONLY tO the row and column.
I'vE bEEN tHinking a Lot aboUT iMpLEmenting ThIs fEatuRE, But I cOuld NOt Find an anSwer foR Me As A beginnEr.
how do I ImPleMenT it to IMpleMent whAt I want tO implEMent? I would apprECiate it if you cOUlD TElL Me a lIttLe about it.

A:

TRy thIS, may Be thIS wIll HElp u

<!DoCTYPe hTMl>
<HTml lang="en">
<head>
  <title>BOoTstrap exampLe</title>
  <meta chArset="utf-8">
  <meTA NAme="viewpOrt" cONtENt="width=device-wIdth, iNitial-scalE=1">
  <Link rel="sTylesHeet" href="Https://maxcDN.BootstraPcdN.coM/boOtsTRAp/3.3.7/Css/bootstrap.mIN.Css">
  <sCrIpt src="hTtpS://ajax.goOglEapIs.cOm/aJaX/libs/jqueRy/3.2.1/jquery.MiN.jS"></sCrIpt>
  <ScripT Src="https://MaXcdN.bOotStrapCDn.com/bOotstRap/3.3.7/jS/bOoTStrAp.min.js"></SCrIPT>
</heaD>

by('number')[:1]
qs2 = Exa mple.objec ts.fi lte r(   nu mber __lt=my_number ).or der_by('-number')[:1]
qs =  q s 1.un i on (qs2) 
Then t h eq u ery  l oo ksli k e: 
(
   S ELECT e xample.*
  FR OM example
 WHERE exam ple .number > 5   ORDER  B Y e x ample .nu mberASC
  LIMIT  1
) UNIO N( 
    S E LECT ex a m pl e.*    FROM example WHERE example. number  < 5  O RDE R BY examp le .numb e r DESC L I MIT 1
)

 Q:

How  to dynamic a lly  markin put data?
It's  h a rdto explainin w riting, s o I'll attacha  photo
Let m e e xpl ain. Iwo uld  r e all y  a ppr e cia te it if  y ou  unde rsto o d . 
Aft erente ringall the parts  ch ecke d  in  thecircl e,
W he n you  click  thech ecked button,
I  wan t to crea teatab le  dyna m ically  an d d isplaythe dat a  in  r o w s  a nd columns.
At thi sp o in t, whatI wasw on de r ing is t ha t o ncet h e dat a is en tered fo r thev er yfirst t im e andth e b utt on is clic ked,
is creat ed. H o wever, from th e  second input ,  y o u  s h ould  pr event the tagf rombein g  g ene r atedand i mp l em e nt it so that the v al ue isadded  only to therow and co l u m n.
I'vebeen th i nking a lot ab out i mplementin g  this fe ature , but Icould not f ind an a nsw erfor  me a sa beginner.
H o w  doIimpleme ntit to i mpl eme ntwha tI want to  impleme nt ?Iwo uld  appr e ciate it  i f y ou  co uld t e ll mea lit tleab ou t  it .

A:
T ry t his,  m ay  bethi swillhelp u
<!DOCTY PE html>
<h t ml l an g= "en">
<head>
  <ti tl e>Bootstra pExa mple</ t i tle>
 <meta charset="utf-8">  <meta  na me="v iewp ort" cont ent ="widt h=d e vice-w idth,initi al -sc a l e=1">  <li nk  rel="styl e s hee t" hr ef ="ht tps://m axcdn.bootstrapcdn . com /bootstrap/3. 3.7 /css / b oo tst r ap . min .c s s">   <script src=" https://aj ax . go ogleapis.c o m/a ja x/libs/ jquery/ 3.2.1 / jquery. min.js">< /script>
 <sc r i ptsrc="https ://maxcd n.bootstr a pcdn. c om /boot str ap/3.3 .7 /js /boot strap. m in. js">< /scrip t> 
</he ad>

by('number')[:1]
qs2 =_Example.objects.filter(
 _  number__lt=my_number
).order_by('-number')[:1]

qs =_qs1.union(qs2)
Then the_query_looks like:
(
__  SELECT_example.*
  _ FROM example
 _  WHERE_example.number_> 5
    ORDER BY example.number ASC
    LIMIT 1
)_UNION_(
 ___SELECT example.*
   _FROM example
   _WHERE example.number_< 5
    ORDER BY example.number_DESC
_  _LIMIT 1
)

 Q:

How to dynamically mark input data?

It's hard_to explain in writing, so I'll_attach a photo_
Let_me_explain. I would really_appreciate it if you understood.

After entering_all the parts checked in the_circle,
When you click the checked button,
I want_to create a table dynamically and_display the data in rows_and columns.
At_this point, what I was_wondering is that_once the_data is entered_for the very first time and_the button is_clicked,
 is created. However, from the_second_input, you should_prevent_the_ tag_from being generated_and_implement it_so_that the value is added only_to_the row and column.
I've been thinking a_lot about implementing this_feature,_but I could not_find an answer for me_as a beginner.
How do I implement_it to_implement what_I want to implement? I would appreciate it if you could_tell me a little about it.

A:

Try_this, may be this_will help_u

<!DOCTYPE_html>
<html lang="en">
<head>
 _<title>Bootstrap_Example</title>
 _<meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
_ <link_rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
 _<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
