rahuketu86 commited on
Commit
c8daf53
·
1 Parent(s): 7674aef

Fixed ContactErrors state issue during new and edit

Browse files
00_datamodel.ipynb CHANGED
@@ -9,7 +9,7 @@
9
  },
10
  {
11
  "cell_type": "code",
12
- "execution_count": 138,
13
  "metadata": {},
14
  "outputs": [
15
  {
@@ -28,19 +28,19 @@
28
  },
29
  {
30
  "cell_type": "code",
31
- "execution_count": 139,
32
  "metadata": {},
33
  "outputs": [],
34
  "source": [
35
  "#|export\n",
36
  "import pandas as pd\n",
37
- "from dataclasses import dataclass\n",
38
  "import re"
39
  ]
40
  },
41
  {
42
  "cell_type": "code",
43
- "execution_count": 140,
44
  "metadata": {},
45
  "outputs": [],
46
  "source": [
@@ -50,7 +50,7 @@
50
  },
51
  {
52
  "cell_type": "code",
53
- "execution_count": 141,
54
  "metadata": {},
55
  "outputs": [],
56
  "source": [
@@ -129,7 +129,7 @@
129
  },
130
  {
131
  "cell_type": "code",
132
- "execution_count": 161,
133
  "metadata": {},
134
  "outputs": [
135
  {
@@ -187,7 +187,7 @@
187
  " 'id': 9}]"
188
  ]
189
  },
190
- "execution_count": 161,
191
  "metadata": {},
192
  "output_type": "execute_result"
193
  }
@@ -200,7 +200,7 @@
200
  },
201
  {
202
  "cell_type": "code",
203
- "execution_count": 162,
204
  "metadata": {},
205
  "outputs": [
206
  {
@@ -249,7 +249,7 @@
249
  "0 John Doe 555-1234 john.doe@example.com 0"
250
  ]
251
  },
252
- "execution_count": 162,
253
  "metadata": {},
254
  "output_type": "execute_result"
255
  }
@@ -266,7 +266,7 @@
266
  },
267
  {
268
  "cell_type": "code",
269
- "execution_count": 163,
270
  "metadata": {},
271
  "outputs": [],
272
  "source": [
@@ -284,11 +284,12 @@
284
  },
285
  {
286
  "cell_type": "code",
287
- "execution_count": 164,
288
  "metadata": {},
289
  "outputs": [],
290
  "source": [
291
  "#|export\n",
 
292
  "class ContactErrors:\n",
293
  " firstname:str = None\n",
294
  " lastname:str = None\n",
@@ -298,7 +299,7 @@
298
  },
299
  {
300
  "cell_type": "code",
301
- "execution_count": 165,
302
  "metadata": {},
303
  "outputs": [],
304
  "source": [
@@ -307,7 +308,7 @@
307
  },
308
  {
309
  "cell_type": "code",
310
- "execution_count": 166,
311
  "metadata": {},
312
  "outputs": [],
313
  "source": [
@@ -320,7 +321,7 @@
320
  },
321
  {
322
  "cell_type": "code",
323
- "execution_count": 167,
324
  "metadata": {},
325
  "outputs": [],
326
  "source": [
@@ -334,7 +335,7 @@
334
  },
335
  {
336
  "cell_type": "code",
337
- "execution_count": 168,
338
  "metadata": {},
339
  "outputs": [],
340
  "source": [
@@ -345,7 +346,7 @@
345
  },
346
  {
347
  "cell_type": "code",
348
- "execution_count": 169,
349
  "metadata": {},
350
  "outputs": [],
351
  "source": [
@@ -359,7 +360,7 @@
359
  },
360
  {
361
  "cell_type": "code",
362
- "execution_count": 170,
363
  "metadata": {},
364
  "outputs": [
365
  {
@@ -389,7 +390,7 @@
389
  },
390
  {
391
  "cell_type": "code",
392
- "execution_count": 171,
393
  "metadata": {},
394
  "outputs": [
395
  {
@@ -413,7 +414,7 @@
413
  },
414
  {
415
  "cell_type": "code",
416
- "execution_count": 192,
417
  "metadata": {},
418
  "outputs": [],
419
  "source": [
@@ -470,7 +471,7 @@
470
  },
471
  {
472
  "cell_type": "code",
473
- "execution_count": 195,
474
  "metadata": {},
475
  "outputs": [],
476
  "source": [
@@ -482,7 +483,7 @@
482
  " phone:str=None\n",
483
  " email:str=None\n",
484
  " id: int =None\n",
485
- " errors:ContactErrors = ContactErrors()\n",
486
  " is_valid:bool=True\n",
487
  "\n",
488
  " def from_contacts_dict(self, c):\n",
@@ -548,7 +549,7 @@
548
  },
549
  {
550
  "cell_type": "code",
551
- "execution_count": 196,
552
  "metadata": {},
553
  "outputs": [
554
  {
@@ -564,7 +565,7 @@
564
  "True"
565
  ]
566
  },
567
- "execution_count": 196,
568
  "metadata": {},
569
  "output_type": "execute_result"
570
  }
@@ -579,7 +580,7 @@
579
  },
580
  {
581
  "cell_type": "code",
582
- "execution_count": 197,
583
  "metadata": {},
584
  "outputs": [
585
  {
@@ -588,7 +589,7 @@
588
  "True"
589
  ]
590
  },
591
- "execution_count": 197,
592
  "metadata": {},
593
  "output_type": "execute_result"
594
  }
@@ -603,7 +604,7 @@
603
  },
604
  {
605
  "cell_type": "code",
606
- "execution_count": 198,
607
  "metadata": {},
608
  "outputs": [
609
  {
@@ -622,7 +623,7 @@
622
  " 'rahuketu@gmail.com']"
623
  ]
624
  },
625
- "execution_count": 198,
626
  "metadata": {},
627
  "output_type": "execute_result"
628
  }
@@ -633,7 +634,7 @@
633
  },
634
  {
635
  "cell_type": "code",
636
- "execution_count": 199,
637
  "metadata": {},
638
  "outputs": [
639
  {
@@ -642,7 +643,7 @@
642
  "Contact[[None, None], [None, None], [None, None], [None, None], [True, '']]"
643
  ]
644
  },
645
- "execution_count": 199,
646
  "metadata": {},
647
  "output_type": "execute_result"
648
  }
@@ -653,7 +654,7 @@
653
  },
654
  {
655
  "cell_type": "code",
656
- "execution_count": 200,
657
  "metadata": {},
658
  "outputs": [
659
  {
@@ -669,7 +670,7 @@
669
  "True"
670
  ]
671
  },
672
- "execution_count": 200,
673
  "metadata": {},
674
  "output_type": "execute_result"
675
  }
@@ -686,7 +687,7 @@
686
  },
687
  {
688
  "cell_type": "code",
689
- "execution_count": 201,
690
  "metadata": {},
691
  "outputs": [],
692
  "source": [
@@ -697,7 +698,7 @@
697
  },
698
  {
699
  "cell_type": "code",
700
- "execution_count": 202,
701
  "metadata": {},
702
  "outputs": [
703
  {
@@ -755,7 +756,7 @@
755
  " 'id': 10}]"
756
  ]
757
  },
758
- "execution_count": 202,
759
  "metadata": {},
760
  "output_type": "execute_result"
761
  }
@@ -774,7 +775,7 @@
774
  },
775
  {
776
  "cell_type": "code",
777
- "execution_count": 203,
778
  "metadata": {},
779
  "outputs": [
780
  {
@@ -787,7 +788,7 @@
787
  " 'id': 1}"
788
  ]
789
  },
790
- "execution_count": 203,
791
  "metadata": {},
792
  "output_type": "execute_result"
793
  }
@@ -799,7 +800,7 @@
799
  },
800
  {
801
  "cell_type": "code",
802
- "execution_count": 204,
803
  "metadata": {},
804
  "outputs": [
805
  {
@@ -812,7 +813,7 @@
812
  " 'id': 2}"
813
  ]
814
  },
815
- "execution_count": 204,
816
  "metadata": {},
817
  "output_type": "execute_result"
818
  }
@@ -823,7 +824,7 @@
823
  },
824
  {
825
  "cell_type": "code",
826
- "execution_count": 206,
827
  "metadata": {},
828
  "outputs": [],
829
  "source": [
 
9
  },
10
  {
11
  "cell_type": "code",
12
+ "execution_count": 263,
13
  "metadata": {},
14
  "outputs": [
15
  {
 
28
  },
29
  {
30
  "cell_type": "code",
31
+ "execution_count": 264,
32
  "metadata": {},
33
  "outputs": [],
34
  "source": [
35
  "#|export\n",
36
  "import pandas as pd\n",
37
+ "from dataclasses import dataclass, field\n",
38
  "import re"
39
  ]
40
  },
41
  {
42
  "cell_type": "code",
43
+ "execution_count": 265,
44
  "metadata": {},
45
  "outputs": [],
46
  "source": [
 
50
  },
51
  {
52
  "cell_type": "code",
53
+ "execution_count": 266,
54
  "metadata": {},
55
  "outputs": [],
56
  "source": [
 
129
  },
130
  {
131
  "cell_type": "code",
132
+ "execution_count": 267,
133
  "metadata": {},
134
  "outputs": [
135
  {
 
187
  " 'id': 9}]"
188
  ]
189
  },
190
+ "execution_count": 267,
191
  "metadata": {},
192
  "output_type": "execute_result"
193
  }
 
200
  },
201
  {
202
  "cell_type": "code",
203
+ "execution_count": 268,
204
  "metadata": {},
205
  "outputs": [
206
  {
 
249
  "0 John Doe 555-1234 john.doe@example.com 0"
250
  ]
251
  },
252
+ "execution_count": 268,
253
  "metadata": {},
254
  "output_type": "execute_result"
255
  }
 
266
  },
267
  {
268
  "cell_type": "code",
269
+ "execution_count": 269,
270
  "metadata": {},
271
  "outputs": [],
272
  "source": [
 
284
  },
285
  {
286
  "cell_type": "code",
287
+ "execution_count": 270,
288
  "metadata": {},
289
  "outputs": [],
290
  "source": [
291
  "#|export\n",
292
+ "@dataclass\n",
293
  "class ContactErrors:\n",
294
  " firstname:str = None\n",
295
  " lastname:str = None\n",
 
299
  },
300
  {
301
  "cell_type": "code",
302
+ "execution_count": 271,
303
  "metadata": {},
304
  "outputs": [],
305
  "source": [
 
308
  },
309
  {
310
  "cell_type": "code",
311
+ "execution_count": 272,
312
  "metadata": {},
313
  "outputs": [],
314
  "source": [
 
321
  },
322
  {
323
  "cell_type": "code",
324
+ "execution_count": 273,
325
  "metadata": {},
326
  "outputs": [],
327
  "source": [
 
335
  },
336
  {
337
  "cell_type": "code",
338
+ "execution_count": 274,
339
  "metadata": {},
340
  "outputs": [],
341
  "source": [
 
346
  },
347
  {
348
  "cell_type": "code",
349
+ "execution_count": 275,
350
  "metadata": {},
351
  "outputs": [],
352
  "source": [
 
360
  },
361
  {
362
  "cell_type": "code",
363
+ "execution_count": 276,
364
  "metadata": {},
365
  "outputs": [
366
  {
 
390
  },
391
  {
392
  "cell_type": "code",
393
+ "execution_count": 277,
394
  "metadata": {},
395
  "outputs": [
396
  {
 
414
  },
415
  {
416
  "cell_type": "code",
417
+ "execution_count": 278,
418
  "metadata": {},
419
  "outputs": [],
420
  "source": [
 
471
  },
472
  {
473
  "cell_type": "code",
474
+ "execution_count": 279,
475
  "metadata": {},
476
  "outputs": [],
477
  "source": [
 
483
  " phone:str=None\n",
484
  " email:str=None\n",
485
  " id: int =None\n",
486
+ " errors:ContactErrors = field(default_factory=lambda: ContactErrors())\n",
487
  " is_valid:bool=True\n",
488
  "\n",
489
  " def from_contacts_dict(self, c):\n",
 
549
  },
550
  {
551
  "cell_type": "code",
552
+ "execution_count": 280,
553
  "metadata": {},
554
  "outputs": [
555
  {
 
565
  "True"
566
  ]
567
  },
568
+ "execution_count": 280,
569
  "metadata": {},
570
  "output_type": "execute_result"
571
  }
 
580
  },
581
  {
582
  "cell_type": "code",
583
+ "execution_count": 281,
584
  "metadata": {},
585
  "outputs": [
586
  {
 
589
  "True"
590
  ]
591
  },
592
+ "execution_count": 281,
593
  "metadata": {},
594
  "output_type": "execute_result"
595
  }
 
604
  },
605
  {
606
  "cell_type": "code",
607
+ "execution_count": 282,
608
  "metadata": {},
609
  "outputs": [
610
  {
 
623
  " 'rahuketu@gmail.com']"
624
  ]
625
  },
626
+ "execution_count": 282,
627
  "metadata": {},
628
  "output_type": "execute_result"
629
  }
 
634
  },
635
  {
636
  "cell_type": "code",
637
+ "execution_count": 283,
638
  "metadata": {},
639
  "outputs": [
640
  {
 
643
  "Contact[[None, None], [None, None], [None, None], [None, None], [True, '']]"
644
  ]
645
  },
646
+ "execution_count": 283,
647
  "metadata": {},
648
  "output_type": "execute_result"
649
  }
 
654
  },
655
  {
656
  "cell_type": "code",
657
+ "execution_count": 284,
658
  "metadata": {},
659
  "outputs": [
660
  {
 
670
  "True"
671
  ]
672
  },
673
+ "execution_count": 284,
674
  "metadata": {},
675
  "output_type": "execute_result"
676
  }
 
687
  },
688
  {
689
  "cell_type": "code",
690
+ "execution_count": 258,
691
  "metadata": {},
692
  "outputs": [],
693
  "source": [
 
698
  },
699
  {
700
  "cell_type": "code",
701
+ "execution_count": 259,
702
  "metadata": {},
703
  "outputs": [
704
  {
 
756
  " 'id': 10}]"
757
  ]
758
  },
759
+ "execution_count": 259,
760
  "metadata": {},
761
  "output_type": "execute_result"
762
  }
 
775
  },
776
  {
777
  "cell_type": "code",
778
+ "execution_count": 260,
779
  "metadata": {},
780
  "outputs": [
781
  {
 
788
  " 'id': 1}"
789
  ]
790
  },
791
+ "execution_count": 260,
792
  "metadata": {},
793
  "output_type": "execute_result"
794
  }
 
800
  },
801
  {
802
  "cell_type": "code",
803
+ "execution_count": 261,
804
  "metadata": {},
805
  "outputs": [
806
  {
 
813
  " 'id': 2}"
814
  ]
815
  },
816
+ "execution_count": 261,
817
  "metadata": {},
818
  "output_type": "execute_result"
819
  }
 
824
  },
825
  {
826
  "cell_type": "code",
827
+ "execution_count": 262,
828
  "metadata": {},
829
  "outputs": [],
830
  "source": [
01_main.ipynb CHANGED
@@ -9,7 +9,7 @@
9
  },
10
  {
11
  "cell_type": "code",
12
- "execution_count": 740,
13
  "metadata": {},
14
  "outputs": [
15
  {
@@ -28,7 +28,7 @@
28
  },
29
  {
30
  "cell_type": "code",
31
- "execution_count": 741,
32
  "metadata": {},
33
  "outputs": [],
34
  "source": [
@@ -41,7 +41,7 @@
41
  },
42
  {
43
  "cell_type": "code",
44
- "execution_count": 742,
45
  "metadata": {},
46
  "outputs": [],
47
  "source": [
@@ -51,7 +51,7 @@
51
  },
52
  {
53
  "cell_type": "code",
54
- "execution_count": 743,
55
  "metadata": {},
56
  "outputs": [],
57
  "source": [
@@ -62,7 +62,7 @@
62
  },
63
  {
64
  "cell_type": "code",
65
- "execution_count": 744,
66
  "metadata": {},
67
  "outputs": [],
68
  "source": [
@@ -74,7 +74,7 @@
74
  },
75
  {
76
  "cell_type": "code",
77
- "execution_count": 745,
78
  "metadata": {},
79
  "outputs": [],
80
  "source": [
@@ -90,7 +90,7 @@
90
  },
91
  {
92
  "cell_type": "code",
93
- "execution_count": 746,
94
  "metadata": {},
95
  "outputs": [
96
  {
@@ -103,7 +103,7 @@
103
  " 'id': 1}"
104
  ]
105
  },
106
- "execution_count": 746,
107
  "metadata": {},
108
  "output_type": "execute_result"
109
  }
@@ -115,7 +115,7 @@
115
  },
116
  {
117
  "cell_type": "code",
118
- "execution_count": 747,
119
  "metadata": {},
120
  "outputs": [],
121
  "source": [
@@ -127,7 +127,7 @@
127
  },
128
  {
129
  "cell_type": "code",
130
- "execution_count": 748,
131
  "metadata": {},
132
  "outputs": [
133
  {
@@ -139,6 +139,7 @@
139
  " <head>\n",
140
  " <title>Contact.App</title>\n",
141
  " <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css\">\n",
 
142
  " <script src=\"https://unpkg.com/htmx.org@2.0.1\"></script>\n",
143
  " </head>\n",
144
  " <body hx-boost=\"true\">\n",
@@ -172,7 +173,7 @@
172
  },
173
  {
174
  "cell_type": "code",
175
- "execution_count": 749,
176
  "metadata": {},
177
  "outputs": [
178
  {
@@ -185,7 +186,7 @@
185
  " 'id': 2}"
186
  ]
187
  },
188
- "execution_count": 749,
189
  "metadata": {},
190
  "output_type": "execute_result"
191
  }
@@ -196,7 +197,7 @@
196
  },
197
  {
198
  "cell_type": "code",
199
- "execution_count": 750,
200
  "metadata": {},
201
  "outputs": [],
202
  "source": [
@@ -226,7 +227,7 @@
226
  },
227
  {
228
  "cell_type": "code",
229
- "execution_count": 751,
230
  "metadata": {},
231
  "outputs": [],
232
  "source": [
@@ -240,7 +241,7 @@
240
  },
241
  {
242
  "cell_type": "code",
243
- "execution_count": 752,
244
  "metadata": {},
245
  "outputs": [],
246
  "source": [
@@ -254,7 +255,7 @@
254
  },
255
  {
256
  "cell_type": "code",
257
- "execution_count": 753,
258
  "metadata": {},
259
  "outputs": [],
260
  "source": [
@@ -264,7 +265,7 @@
264
  },
265
  {
266
  "cell_type": "code",
267
- "execution_count": 754,
268
  "metadata": {},
269
  "outputs": [],
270
  "source": [
@@ -276,7 +277,7 @@
276
  },
277
  {
278
  "cell_type": "code",
279
- "execution_count": 755,
280
  "metadata": {},
281
  "outputs": [],
282
  "source": [
@@ -298,7 +299,7 @@
298
  },
299
  {
300
  "cell_type": "code",
301
- "execution_count": 762,
302
  "metadata": {},
303
  "outputs": [],
304
  "source": [
@@ -309,7 +310,7 @@
309
  },
310
  {
311
  "cell_type": "code",
312
- "execution_count": 759,
313
  "metadata": {},
314
  "outputs": [],
315
  "source": []
 
9
  },
10
  {
11
  "cell_type": "code",
12
+ "execution_count": 766,
13
  "metadata": {},
14
  "outputs": [
15
  {
 
28
  },
29
  {
30
  "cell_type": "code",
31
+ "execution_count": 767,
32
  "metadata": {},
33
  "outputs": [],
34
  "source": [
 
41
  },
42
  {
43
  "cell_type": "code",
44
+ "execution_count": 768,
45
  "metadata": {},
46
  "outputs": [],
47
  "source": [
 
51
  },
52
  {
53
  "cell_type": "code",
54
+ "execution_count": 769,
55
  "metadata": {},
56
  "outputs": [],
57
  "source": [
 
62
  },
63
  {
64
  "cell_type": "code",
65
+ "execution_count": 770,
66
  "metadata": {},
67
  "outputs": [],
68
  "source": [
 
74
  },
75
  {
76
  "cell_type": "code",
77
+ "execution_count": 771,
78
  "metadata": {},
79
  "outputs": [],
80
  "source": [
 
90
  },
91
  {
92
  "cell_type": "code",
93
+ "execution_count": 772,
94
  "metadata": {},
95
  "outputs": [
96
  {
 
103
  " 'id': 1}"
104
  ]
105
  },
106
+ "execution_count": 772,
107
  "metadata": {},
108
  "output_type": "execute_result"
109
  }
 
115
  },
116
  {
117
  "cell_type": "code",
118
+ "execution_count": 773,
119
  "metadata": {},
120
  "outputs": [],
121
  "source": [
 
127
  },
128
  {
129
  "cell_type": "code",
130
+ "execution_count": 774,
131
  "metadata": {},
132
  "outputs": [
133
  {
 
139
  " <head>\n",
140
  " <title>Contact.App</title>\n",
141
  " <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css\">\n",
142
+ " <link rel=\"stylesheet\" href=\"/static/css/site.css\">\n",
143
  " <script src=\"https://unpkg.com/htmx.org@2.0.1\"></script>\n",
144
  " </head>\n",
145
  " <body hx-boost=\"true\">\n",
 
173
  },
174
  {
175
  "cell_type": "code",
176
+ "execution_count": 775,
177
  "metadata": {},
178
  "outputs": [
179
  {
 
186
  " 'id': 2}"
187
  ]
188
  },
189
+ "execution_count": 775,
190
  "metadata": {},
191
  "output_type": "execute_result"
192
  }
 
197
  },
198
  {
199
  "cell_type": "code",
200
+ "execution_count": 776,
201
  "metadata": {},
202
  "outputs": [],
203
  "source": [
 
227
  },
228
  {
229
  "cell_type": "code",
230
+ "execution_count": 777,
231
  "metadata": {},
232
  "outputs": [],
233
  "source": [
 
241
  },
242
  {
243
  "cell_type": "code",
244
+ "execution_count": 778,
245
  "metadata": {},
246
  "outputs": [],
247
  "source": [
 
255
  },
256
  {
257
  "cell_type": "code",
258
+ "execution_count": 779,
259
  "metadata": {},
260
  "outputs": [],
261
  "source": [
 
265
  },
266
  {
267
  "cell_type": "code",
268
+ "execution_count": 780,
269
  "metadata": {},
270
  "outputs": [],
271
  "source": [
 
277
  },
278
  {
279
  "cell_type": "code",
280
+ "execution_count": 781,
281
  "metadata": {},
282
  "outputs": [],
283
  "source": [
 
299
  },
300
  {
301
  "cell_type": "code",
302
+ "execution_count": 783,
303
  "metadata": {},
304
  "outputs": [],
305
  "source": [
 
310
  },
311
  {
312
  "cell_type": "code",
313
+ "execution_count": null,
314
  "metadata": {},
315
  "outputs": [],
316
  "source": []
__pycache__/datamodel.cpython-312.pyc CHANGED
Binary files a/__pycache__/datamodel.cpython-312.pyc and b/__pycache__/datamodel.cpython-312.pyc differ
 
__pycache__/main.cpython-312.pyc CHANGED
Binary files a/__pycache__/main.cpython-312.pyc and b/__pycache__/main.cpython-312.pyc differ
 
contactdb.json CHANGED
@@ -1 +1 @@
1
- [{"firstname":"Jane","lastname":"Smith","phone":"555-5678","email":"jane.smith@example.com","id":1.0},{"firstname":"Alice","lastname":"Johnson","phone":"555-8765","email":"alice.johnson@example.com","id":2.0},{"firstname":"Bob","lastname":"Williams","phone":"555-4321","email":"bob.williams@example.com","id":3.0},{"firstname":"Charlie","lastname":"Brown","phone":"555-9876","email":"charlie.brown@example.com","id":4.0},{"firstname":"Diana","lastname":"Miller","phone":"555-6543","email":"diana.miller@example.com","id":5.0},{"firstname":"Edward","lastname":"Davis","phone":"555-3456","email":"edward.davis@example.com","id":6.0},{"firstname":"Fiona","lastname":"Garcia","phone":"555-6789","email":"fiona.garcia@example.com","id":7.0},{"firstname":"George","lastname":"Martinez","phone":"555-7890","email":"george.martinez@example.com","id":8.0},{"firstname":"Hannah","lastname":"Rodriguez","phone":"555-8901","email":"hannah.rodriguez@example.com","id":9.0},{"firstname":"Rahul","lastname":"Saraf","phone":"888-7986","email":"fake@email.com","id":10.0}]
 
1
+ [{"firstname":"John","lastname":"Doe","phone":"555-1001","email":"john.doe@example.com","id":0},{"firstname":"Jane","lastname":"Smith","phone":"555-5678","email":"jane.smith@example.com","id":1},{"firstname":"Alice","lastname":"Johnson","phone":"555-8765","email":"alice.johnson@example.com","id":2},{"firstname":"Bob","lastname":"Williams","phone":"555-4321","email":"bob.williams@example.com","id":3},{"firstname":"Charlie","lastname":"Brown","phone":"555-9876","email":"charlie.brown@example.com","id":4},{"firstname":"Diana","lastname":"Miller","phone":"555-6543","email":"diana.miller@example.com","id":5},{"firstname":"Edward","lastname":"Davis","phone":"555-3456","email":"edward.davis@example.com","id":6},{"firstname":"Fiona","lastname":"Garcia","phone":"555-6789","email":"fiona.garcia@example.com","id":7},{"firstname":"George","lastname":"Martinez","phone":"555-7890","email":"george.martinez@example.com","id":8},{"firstname":"Hannah","lastname":"Rodriguez","phone":"555-8901","email":"hannah.rodriguez@example.com","id":9},{"firstname":"Rahul","lastname":"Saraf","phone":"555-1200","email":"rahuketu@gmail.com","id":10}]
datamodel.py CHANGED
@@ -6,10 +6,11 @@ __all__ = ['email_regex', 'phone_regex', 'ContactErrors', 'validate_email', 'che
6
 
7
  # %% 00_datamodel.ipynb 2
8
  import pandas as pd
9
- from dataclasses import dataclass
10
  import re
11
 
12
  # %% 00_datamodel.ipynb 8
 
13
  class ContactErrors:
14
  firstname:str = None
15
  lastname:str = None
@@ -96,7 +97,7 @@ class Contact:
96
  phone:str=None
97
  email:str=None
98
  id: int =None
99
- errors:ContactErrors = ContactErrors()
100
  is_valid:bool=True
101
 
102
  def from_contacts_dict(self, c):
 
6
 
7
  # %% 00_datamodel.ipynb 2
8
  import pandas as pd
9
+ from dataclasses import dataclass, field
10
  import re
11
 
12
  # %% 00_datamodel.ipynb 8
13
+ @dataclass
14
  class ContactErrors:
15
  firstname:str = None
16
  lastname:str = None
 
97
  phone:str=None
98
  email:str=None
99
  id: int =None
100
+ errors:ContactErrors = field(default_factory=lambda: ContactErrors())
101
  is_valid:bool=True
102
 
103
  def from_contacts_dict(self, c):
static/css/site.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ .error {
2
+ display: inline-block;
3
+ color: darkred;
4
+ }
templates/layout.html CHANGED
@@ -3,6 +3,7 @@
3
  <head>
4
  <title>Contact.App</title>
5
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
 
6
  <script src="https://unpkg.com/htmx.org@2.0.1"></script>
7
  </head>
8
  <body hx-boost="true">
 
3
  <head>
4
  <title>Contact.App</title>
5
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
6
+ <link rel="stylesheet" href="/static/css/site.css">
7
  <script src="https://unpkg.com/htmx.org@2.0.1"></script>
8
  </head>
9
  <body hx-boost="true">