Files
@ c1abf4717df0
Branch filter:
Location: symposion_app/vendor/registrasion/views.py - annotation
c1abf4717df0
31.2 KiB
text/x-python
Vendor registration
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | 6dbc303e7c38 66dedfc101b1 be277c17d22d 1b7d8a60c119 9c289acadda4 875f736d67c5 875f736d67c5 875f736d67c5 3ab5ac32cadc 1b7d8a60c119 680ce689f635 3ab5ac32cadc a4de15830c18 c2065dd4b90a fc279b1922d3 a4d684f444e7 1b7d8a60c119 8324b5109474 8324b5109474 6e4d2fab16ad be277c17d22d 1b7d8a60c119 a2fa1d6548ad 897915f1217d 8324b5109474 1b7d8a60c119 745f6db444fa 19b59d767671 c949a87b8a0e a4de15830c18 1b7d8a60c119 c949a87b8a0e 1b7d8a60c119 1b7d8a60c119 9c289acadda4 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 4cdbdb71ceee 9c289acadda4 4cdbdb71ceee 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 4cdbdb71ceee 9c289acadda4 4cdbdb71ceee 9c289acadda4 9c289acadda4 8324b5109474 12e4d0a3cb24 eb530bd4855e 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 9c289acadda4 eb530bd4855e eb530bd4855e eb530bd4855e 01b9adbaf46e 97438624e1ca 97438624e1ca dcad2d5f7cb2 dcad2d5f7cb2 8324b5109474 8324b5109474 875f736d67c5 8324b5109474 478b328e41a8 640db7e3dced 478b328e41a8 8324b5109474 660e8cb75f67 be277c17d22d 660e8cb75f67 660e8cb75f67 dcad2d5f7cb2 97438624e1ca 97438624e1ca 97438624e1ca 97438624e1ca 97438624e1ca 97438624e1ca 97438624e1ca 97438624e1ca 97438624e1ca 97438624e1ca 97438624e1ca 97438624e1ca 97438624e1ca eefec32cb0fd eefec32cb0fd 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 eb530bd4855e 01b9adbaf46e dcad2d5f7cb2 8324b5109474 875f736d67c5 01b9adbaf46e 01b9adbaf46e 01b9adbaf46e 01b9adbaf46e 01b9adbaf46e 01b9adbaf46e 01b9adbaf46e 8324b5109474 01b9adbaf46e 01b9adbaf46e 01b9adbaf46e dcad2d5f7cb2 01b9adbaf46e 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 875f736d67c5 53413388e016 53413388e016 53413388e016 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 53413388e016 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 01b9adbaf46e 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 76e6206d0987 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 8324b5109474 01b9adbaf46e 01b9adbaf46e 8324b5109474 8324b5109474 eb530bd4855e 8324b5109474 8324b5109474 8324b5109474 12e4d0a3cb24 8324b5109474 8324b5109474 8324b5109474 dcad2d5f7cb2 eb530bd4855e 640db7e3dced 640db7e3dced 640db7e3dced 640db7e3dced 640db7e3dced 640db7e3dced b5cbc3e39e27 640db7e3dced 640db7e3dced 640db7e3dced 640db7e3dced 236c61eefa0d 05923a9a8f58 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 eefec32cb0fd 466c664b680a 26af6e86720f 26af6e86720f 26af6e86720f 26af6e86720f 26af6e86720f 26af6e86720f 26af6e86720f 466c664b680a 466c664b680a 466c664b680a 466c664b680a 466c664b680a 12e4d0a3cb24 6e4d2fab16ad 6e4d2fab16ad 6611546a355c 6e4d2fab16ad 6e4d2fab16ad 6e4d2fab16ad 6611546a355c 6e4d2fab16ad 6e4d2fab16ad 6e4d2fab16ad eefec32cb0fd 466c664b680a 466c664b680a 875f736d67c5 05923a9a8f58 05923a9a8f58 be277c17d22d 875f736d67c5 875f736d67c5 875f736d67c5 05923a9a8f58 05923a9a8f58 05923a9a8f58 89cba55807c1 89cba55807c1 89cba55807c1 89cba55807c1 89cba55807c1 89cba55807c1 89cba55807c1 89cba55807c1 89cba55807c1 89cba55807c1 3a6b4125e974 89cba55807c1 89cba55807c1 be277c17d22d 466c664b680a 89cba55807c1 466c664b680a 466c664b680a 466c664b680a 466c664b680a 466c664b680a 05923a9a8f58 05923a9a8f58 05923a9a8f58 05923a9a8f58 236c61eefa0d 466c664b680a 8d66ed57150d 12e4d0a3cb24 1b7d8a60c119 1b7d8a60c119 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 eb530bd4855e 1b7d8a60c119 2d6b28c5a6da 2d6b28c5a6da 2d6b28c5a6da 464684f13e7b 464684f13e7b eefec32cb0fd 464684f13e7b 464684f13e7b 1b7d8a60c119 875f736d67c5 dcad2d5f7cb2 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 26af6e86720f 26af6e86720f 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 64ca477cb89a 64ca477cb89a 64ca477cb89a 64ca477cb89a 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 3ab5ac32cadc 834233cd72a9 834233cd72a9 834233cd72a9 834233cd72a9 640db7e3dced 640db7e3dced 640db7e3dced 640db7e3dced 640db7e3dced 640db7e3dced 834233cd72a9 834233cd72a9 834233cd72a9 834233cd72a9 834233cd72a9 834233cd72a9 834233cd72a9 834233cd72a9 e0e0d4bf3bb0 834233cd72a9 834233cd72a9 eefec32cb0fd 834233cd72a9 834233cd72a9 834233cd72a9 834233cd72a9 834233cd72a9 834233cd72a9 3562772c13cc 1b7d8a60c119 464684f13e7b 875f736d67c5 834233cd72a9 464684f13e7b 53413388e016 464684f13e7b 53413388e016 53413388e016 53413388e016 53413388e016 53413388e016 53413388e016 53413388e016 53413388e016 53413388e016 464684f13e7b 834233cd72a9 464684f13e7b 464684f13e7b 834233cd72a9 464684f13e7b 464684f13e7b 834233cd72a9 8796670328dc eefec32cb0fd 464684f13e7b 464684f13e7b 464684f13e7b 464684f13e7b 875f736d67c5 875f736d67c5 464684f13e7b 464684f13e7b 464684f13e7b 464684f13e7b 834233cd72a9 464684f13e7b 464684f13e7b eff5686dcf29 834233cd72a9 2d6b28c5a6da 3b5b958b78b6 3b5b958b78b6 3b5b958b78b6 3b5b958b78b6 3b5b958b78b6 162db2481781 162db2481781 162db2481781 162db2481781 464684f13e7b 834233cd72a9 8d66ed57150d db332da9584d eefec32cb0fd 8796670328dc d52fc6eb9d63 a4d684f444e7 d52fc6eb9d63 d52fc6eb9d63 d52fc6eb9d63 53413388e016 875f736d67c5 8e95bb746990 de8301577617 d52fc6eb9d63 64ca477cb89a 53413388e016 d52fc6eb9d63 8796670328dc 6d52a4c18ff8 8796670328dc 8796670328dc 8796670328dc 8796670328dc a4d684f444e7 a4d684f444e7 a4d684f444e7 d52fc6eb9d63 745f6db444fa db332da9584d eefec32cb0fd b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 875f736d67c5 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 b13e6f7ce2c2 8d66ed57150d db332da9584d a4de15830c18 1152e185d136 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 1152e185d136 1152e185d136 1152e185d136 1152e185d136 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 1b9f76823f6a a4de15830c18 1152e185d136 1152e185d136 1152e185d136 1152e185d136 1152e185d136 1152e185d136 1152e185d136 1152e185d136 1152e185d136 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 2d8602a6da31 a4de15830c18 a4de15830c18 a4de15830c18 8e95bb746990 2d8602a6da31 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 0340b6da2064 a4de15830c18 8e95bb746990 ea1d6f52e693 bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 bf053242deb8 2d8602a6da31 2d8602a6da31 bf053242deb8 2d8602a6da31 a4de15830c18 875f736d67c5 ea1d6f52e693 bf053242deb8 bf053242deb8 ea1d6f52e693 d2d2a1b0ecdd d2d2a1b0ecdd bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 bf053242deb8 ea1d6f52e693 ea1d6f52e693 ea1d6f52e693 ea1d6f52e693 ea1d6f52e693 2d8602a6da31 2d8602a6da31 ea1d6f52e693 ea1d6f52e693 ea1d6f52e693 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 1b9f76823f6a 1b9f76823f6a 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 2d8602a6da31 ea1d6f52e693 ea1d6f52e693 9f72b67510ec a4de15830c18 ea1d6f52e693 ea1d6f52e693 ea1d6f52e693 ae8f39381f4a ea1d6f52e693 ea1d6f52e693 a4de15830c18 a4de15830c18 a4de15830c18 a4de15830c18 e0e0d4bf3bb0 e118a4e74c8c 8d66ed57150d a2fa1d6548ad a2fa1d6548ad a2fa1d6548ad a2fa1d6548ad 4cdbdb71ceee a2fa1d6548ad 94a42c100bbd 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 94a42c100bbd 94a42c100bbd 94a42c100bbd 9f72b67510ec e118a4e74c8c 94a42c100bbd 94a42c100bbd 94a42c100bbd 94a42c100bbd 94a42c100bbd 94a42c100bbd a2fa1d6548ad 42912519f1e3 94a42c100bbd 94a42c100bbd 94a42c100bbd 94a42c100bbd 94a42c100bbd a2fa1d6548ad 94a42c100bbd 94a42c100bbd 94a42c100bbd 94a42c100bbd 2c94e7538a6e 2c94e7538a6e a2fa1d6548ad 2c94e7538a6e 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 2c94e7538a6e 9f72b67510ec 2c94e7538a6e 2c94e7538a6e 2c94e7538a6e 2c94e7538a6e 2c94e7538a6e 2c94e7538a6e 2c94e7538a6e 2c94e7538a6e 680ce689f635 680ce689f635 a2fa1d6548ad 680ce689f635 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 4373b7260dae 2ca644e5002d 2ca644e5002d 2ca644e5002d 4373b7260dae 4373b7260dae 680ce689f635 680ce689f635 5b03ae8ff629 9f72b67510ec 680ce689f635 7e8d044a9f51 a2fa1d6548ad 7e8d044a9f51 7e8d044a9f51 7e8d044a9f51 7e8d044a9f51 7e8d044a9f51 7e8d044a9f51 7e8d044a9f51 7e8d044a9f51 7e8d044a9f51 2ca644e5002d 2ca644e5002d 2ca644e5002d 2ca644e5002d 2ca644e5002d 7e8d044a9f51 7e8d044a9f51 875f736d67c5 7e8d044a9f51 875f736d67c5 875f736d67c5 875f736d67c5 7e8d044a9f51 7e8d044a9f51 7e8d044a9f51 7e8d044a9f51 7e8d044a9f51 a2fa1d6548ad 7e8d044a9f51 875f736d67c5 875f736d67c5 7e8d044a9f51 7e8d044a9f51 4373b7260dae 4373b7260dae 4373b7260dae 7e8d044a9f51 2ca644e5002d 2ca644e5002d 2ca644e5002d 2ca644e5002d 2ca644e5002d 2ca644e5002d 2ca644e5002d 2ca644e5002d 2ca644e5002d 680ce689f635 680ce689f635 7e8d044a9f51 7e8d044a9f51 2ca644e5002d 680ce689f635 680ce689f635 680ce689f635 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d b9ee438b891e b9ee438b891e 897915f1217d 897915f1217d 897915f1217d 897915f1217d 897915f1217d 9dd31128bbba 9dd31128bbba 9dd31128bbba 9dd31128bbba 5703221fbaf6 5703221fbaf6 5703221fbaf6 5703221fbaf6 5703221fbaf6 c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a 3903d2be56d6 3903d2be56d6 3903d2be56d6 c2065dd4b90a c2065dd4b90a c2065dd4b90a 3903d2be56d6 5703221fbaf6 5703221fbaf6 5703221fbaf6 5703221fbaf6 5703221fbaf6 5703221fbaf6 c2065dd4b90a 897915f1217d c2065dd4b90a c2065dd4b90a c2065dd4b90a c2065dd4b90a 5703221fbaf6 897915f1217d 897915f1217d 897915f1217d 6dbc303e7c38 6dbc303e7c38 6dbc303e7c38 6dbc303e7c38 6dbc303e7c38 6dbc303e7c38 6dbc303e7c38 6dbc303e7c38 6dbc303e7c38 6dbc303e7c38 6dbc303e7c38 6dbc303e7c38 fcf4e5cffb54 fcf4e5cffb54 06fe8a8ffa65 06fe8a8ffa65 06fe8a8ffa65 06fe8a8ffa65 06fe8a8ffa65 17693754de69 fcf4e5cffb54 274187b8bf7e 274187b8bf7e fcf4e5cffb54 fcf4e5cffb54 17693754de69 17693754de69 fcf4e5cffb54 479bdd36a3a2 fcf4e5cffb54 fcf4e5cffb54 fcf4e5cffb54 de902a213d3e fcf4e5cffb54 fcf4e5cffb54 06fe8a8ffa65 06fe8a8ffa65 19b59d767671 19b59d767671 19b59d767671 19b59d767671 19b59d767671 19b59d767671 19b59d767671 19b59d767671 17693754de69 17693754de69 19b59d767671 19b59d767671 19b59d767671 06fe8a8ffa65 06fe8a8ffa65 479bdd36a3a2 06fe8a8ffa65 06fe8a8ffa65 06fe8a8ffa65 19b59d767671 051a942ffe66 051a942ffe66 06fe8a8ffa65 051a942ffe66 051a942ffe66 42711dde6996 9da41c06de54 9da41c06de54 9da41c06de54 9da41c06de54 9da41c06de54 9da41c06de54 9da41c06de54 78714600bf70 9da41c06de54 78714600bf70 78714600bf70 9da41c06de54 9da41c06de54 9da41c06de54 9da41c06de54 78714600bf70 78714600bf70 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 17693754de69 17693754de69 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 66dedfc101b1 78714600bf70 78714600bf70 78714600bf70 78714600bf70 78714600bf70 78714600bf70 78714600bf70 78714600bf70 78714600bf70 | import datetime
import zipfile
from registrasion import forms
from registrasion import util
from registrasion.models import commerce
from registrasion.models import inventory
from registrasion.models import people
from registrasion.controllers.batch import BatchController
from registrasion.controllers.cart import CartController
from registrasion.controllers.credit_note import CreditNoteController
from registrasion.controllers.discount import DiscountController
from registrasion.controllers.invoice import InvoiceController
from registrasion.controllers.item import ItemController
from registrasion.controllers.product import ProductController
from registrasion.exceptions import CartValidationError
from collections import namedtuple
from django import forms as django_forms
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.decorators import user_passes_test
from django.contrib.auth.models import User
from django.contrib import messages
from django.core.exceptions import ObjectDoesNotExist
from django.core.exceptions import ValidationError
from django.core.mail import send_mass_mail
from django.http import Http404, HttpResponse
from django.shortcuts import redirect
from django.shortcuts import render
from django.template import Context, Template, loader
_GuidedRegistrationSection = namedtuple(
"GuidedRegistrationSection",
(
"title",
"discounts",
"description",
"form",
)
)
@util.all_arguments_optional
class GuidedRegistrationSection(_GuidedRegistrationSection):
''' Represents a section of a guided registration page.
Attributes:
title (str): The title of the section.
discounts ([registrasion.contollers.discount.DiscountAndQuantity, ...]):
A list of discount objects that are available in the section. You
can display ``.clause`` to show what the discount applies to, and
``.quantity`` to display the number of times that discount can be
applied.
description (str): A description of the section.
form (forms.Form): A form to display.
'''
pass
@login_required
def guided_registration(request):
''' Goes through the registration process in order, making sure user sees
all valid categories.
The user must be logged in to see this view.
Returns:
render: Renders ``registrasion/guided_registration.html``,
with the following data::
{
"current_step": int(), # The current step in the
# registration
"sections": sections, # A list of
# GuidedRegistrationSections
"title": str(), # The title of the page
"total_steps": int(), # The total number of steps
}
'''
SESSION_KEY = "guided_registration_categories"
ASK_FOR_PROFILE = 777 # Magic number. Meh.
next_step = redirect("guided_registration")
sections = []
attendee = people.Attendee.get_instance(request.user)
if attendee.completed_registration:
return redirect(review)
# Step 1: Fill in a badge and collect a voucher code
try:
profile = attendee.attendeeprofilebase
except ObjectDoesNotExist:
profile = None
# Figure out if we need to show the profile form and the voucher form
show_profile_and_voucher = False
if SESSION_KEY not in request.session:
if not profile:
show_profile_and_voucher = True
else:
if request.session[SESSION_KEY] == ASK_FOR_PROFILE:
show_profile_and_voucher = True
if show_profile_and_voucher:
# Keep asking for the profile until everything passes.
request.session[SESSION_KEY] = ASK_FOR_PROFILE
voucher_form, voucher_handled = _handle_voucher(request, "voucher")
profile_form, profile_handled = _handle_profile(request, "profile")
voucher_section = GuidedRegistrationSection(
title="Voucher Code",
form=voucher_form,
)
profile_section = GuidedRegistrationSection(
title="Profile and Personal Information",
form=profile_form,
)
title = "Attendee information"
current_step = 1
sections.append(voucher_section)
sections.append(profile_section)
else:
# We're selling products
starting = attendee.guided_categories_complete.count() == 0
# Get the next category
cats = inventory.Category.objects
if SESSION_KEY in request.session:
_cats = request.session[SESSION_KEY]
cats = cats.filter(id__in=_cats)
else:
cats = cats.exclude(
id__in=attendee.guided_categories_complete.all(),
)
cats = cats.order_by("order")
request.session[SESSION_KEY] = []
if starting:
# Only display the first Category
title = "Select ticket type"
current_step = 2
cats = [cats[0]]
else:
# Set title appropriately for remaining categories
current_step = 3
title = "Additional items"
all_products = inventory.Product.objects.filter(
category__in=cats,
).select_related("category")
with BatchController.batch(request.user):
available_products = set(ProductController.available_products(
request.user,
products=all_products,
))
if len(available_products) == 0:
# We've filled in every category
attendee.completed_registration = True
attendee.save()
return next_step
for category in cats:
products = [
i for i in available_products
if i.category == category
]
prefix = "category_" + str(category.id)
p = _handle_products(request, category, products, prefix)
products_form, discounts, products_handled = p
section = GuidedRegistrationSection(
title=category.name,
description=category.description,
discounts=discounts,
form=products_form,
)
if products:
# This product category has items to show.
sections.append(section)
# Add this to the list of things to show if the form
# errors.
request.session[SESSION_KEY].append(category.id)
if request.method == "POST" and not products_form.errors:
# This is only saved if we pass each form with no
# errors, and if the form actually has products.
attendee.guided_categories_complete.add(category)
if sections and request.method == "POST":
for section in sections:
if section.form.errors:
break
else:
attendee.save()
if SESSION_KEY in request.session:
del request.session[SESSION_KEY]
# We've successfully processed everything
return next_step
data = {
"current_step": current_step,
"sections": sections,
"title": title,
"total_steps": 3,
}
return render(request, "registrasion/guided_registration.html", data)
@login_required
def review(request):
''' View for the review page. '''
return render(
request,
"registrasion/review.html",
{},
)
@login_required
def edit_profile(request):
''' View for editing an attendee's profile
The user must be logged in to edit their profile.
Returns:
redirect or render:
In the case of a ``POST`` request, it'll redirect to ``dashboard``,
or otherwise, it will render ``registrasion/profile_form.html``
with data::
{
"form": form, # Instance of ATTENDEE_PROFILE_FORM.
}
'''
form, handled = _handle_profile(request, "profile")
if handled and not form.errors:
messages.success(
request,
"Your attendee profile was updated.",
)
return redirect("dashboard")
data = {
"form": form,
}
return render(request, "registrasion/profile_form.html", data)
# Define the attendee profile form, or get a default.
try:
ProfileForm = util.get_object_from_name(settings.ATTENDEE_PROFILE_FORM)
except:
class ProfileForm(django_forms.ModelForm):
class Meta:
model = util.get_object_from_name(settings.ATTENDEE_PROFILE_MODEL)
exclude = ["attendee"]
def _handle_profile(request, prefix):
''' Returns a profile form instance, and a boolean which is true if the
form was handled. '''
attendee = people.Attendee.get_instance(request.user)
try:
profile = attendee.attendeeprofilebase
profile = people.AttendeeProfileBase.objects.get_subclass(
pk=profile.id,
)
except ObjectDoesNotExist:
profile = None
# Load a pre-entered name from the speaker's profile,
# if they have one.
try:
speaker_profile = request.user.speaker_profile
speaker_name = speaker_profile.name
except ObjectDoesNotExist:
speaker_name = None
name_field = ProfileForm.Meta.model.name_field()
initial = {}
if profile is None and name_field is not None:
initial[name_field] = speaker_name
form = ProfileForm(
request.POST or None,
initial=initial,
instance=profile,
prefix=prefix
)
handled = True if request.POST else False
if request.POST and form.is_valid():
form.instance.attendee = attendee
form.save()
return form, handled
@login_required
def product_category(request, category_id):
''' Form for selecting products from an individual product category.
Arguments:
category_id (castable to int): The id of the category to display.
Returns:
redirect or render:
If the form has been sucessfully submitted, redirect to
``dashboard``. Otherwise, render
``registrasion/product_category.html`` with data::
{
"category": category, # An inventory.Category for
# category_id
"discounts": discounts, # A list of
# DiscountAndQuantity
"form": products_form, # A form for selecting
# products
"voucher_form": voucher_form, # A form for entering a
# voucher code
}
'''
PRODUCTS_FORM_PREFIX = "products"
VOUCHERS_FORM_PREFIX = "vouchers"
# Handle the voucher form *before* listing products.
# Products can change as vouchers are entered.
v = _handle_voucher(request, VOUCHERS_FORM_PREFIX)
voucher_form, voucher_handled = v
category_id = int(category_id) # Routing is [0-9]+
category = inventory.Category.objects.get(pk=category_id)
with BatchController.batch(request.user):
products = ProductController.available_products(
request.user,
category=category,
)
if not products:
messages.warning(
request,
(
"There are no products available from category: " +
category.name
),
)
return redirect("dashboard")
p = _handle_products(request, category, products, PRODUCTS_FORM_PREFIX)
products_form, discounts, products_handled = p
if request.POST and not voucher_handled and not products_form.errors:
# Only return to the dashboard if we didn't add a voucher code
# and if there's no errors in the products form
if products_form.has_changed():
messages.success(
request,
"Your reservations have been updated.",
)
return redirect(review)
data = {
"category": category,
"discounts": discounts,
"form": products_form,
"voucher_form": voucher_form,
}
return render(request, "registrasion/product_category.html", data)
def _handle_products(request, category, products, prefix):
''' Handles a products list form in the given request. Returns the
form instance, the discounts applicable to this form, and whether the
contents were handled. '''
current_cart = CartController.for_user(request.user)
ProductsForm = forms.ProductsForm(category, products)
# Create initial data for each of products in category
items = commerce.ProductItem.objects.filter(
product__in=products,
cart=current_cart.cart,
).select_related("product")
quantities = []
seen = set()
for item in items:
quantities.append((item.product, item.quantity))
seen.add(item.product)
zeros = set(products) - seen
for product in zeros:
quantities.append((product, 0))
products_form = ProductsForm(
request.POST or None,
product_quantities=quantities,
prefix=prefix,
)
if request.method == "POST" and products_form.is_valid():
if products_form.has_changed():
_set_quantities_from_products_form(products_form, current_cart)
# If category is required, the user must have at least one
# in an active+valid cart
if category.required:
carts = commerce.Cart.objects.filter(user=request.user)
items = commerce.ProductItem.objects.filter(
product__category=category,
cart=carts,
)
if len(items) == 0:
products_form.add_error(
None,
"You must have at least one item from this category",
)
handled = False if products_form.errors else True
# Making this a function to lazily evaluate when it's displayed
# in templates.
discounts = util.lazy(
DiscountController.available_discounts,
request.user,
[],
products,
)
return products_form, discounts, handled
def _set_quantities_from_products_form(products_form, current_cart):
# Makes id_to_quantity, a dictionary from product ID to its quantity
quantities = list(products_form.product_quantities())
id_to_quantity = dict(quantities)
# Get the actual product objects
pks = [i[0] for i in quantities]
products = inventory.Product.objects.filter(
id__in=pks,
).select_related("category").order_by("id")
quantities.sort(key=lambda i: i[0])
# Match the product objects to their quantities
product_quantities = [
(product, id_to_quantity[product.id]) for product in products
]
try:
current_cart.set_quantities(product_quantities)
except CartValidationError as ve:
for ve_field in ve.error_list:
product, message = ve_field.message
products_form.add_product_error(product, message)
def _handle_voucher(request, prefix):
''' Handles a voucher form in the given request. Returns the voucher
form instance, and whether the voucher code was handled. '''
voucher_form = forms.VoucherForm(request.POST or None, prefix=prefix)
current_cart = CartController.for_user(request.user)
if (voucher_form.is_valid() and
voucher_form.cleaned_data["voucher"].strip()):
voucher = voucher_form.cleaned_data["voucher"]
voucher = inventory.Voucher.normalise_code(voucher)
if len(current_cart.cart.vouchers.filter(code=voucher)) > 0:
# This voucher has already been applied to this cart.
# Do not apply code
handled = False
else:
try:
current_cart.apply_voucher(voucher)
except Exception as e:
voucher_form.add_error("voucher", e)
handled = True
else:
handled = False
return (voucher_form, handled)
@login_required
def checkout(request, user_id=None):
''' Runs the checkout process for the current cart.
If the query string contains ``fix_errors=true``, Registrasion will attempt
to fix errors preventing the system from checking out, including by
cancelling expired discounts and vouchers, and removing any unavailable
products.
Arguments:
user_id (castable to int):
If the requesting user is staff, then the user ID can be used to
run checkout for another user.
Returns:
render or redirect:
If the invoice is generated successfully, or there's already a
valid invoice for the current cart, redirect to ``invoice``.
If there are errors when generating the invoice, render
``registrasion/checkout_errors.html`` with the following data::
{
"error_list", [str, ...] # The errors to display.
}
'''
if user_id is not None:
if request.user.is_staff:
user = User.objects.get(id=int(user_id))
else:
raise Http404()
else:
user = request.user
current_cart = CartController.for_user(user)
if "fix_errors" in request.GET and request.GET["fix_errors"] == "true":
current_cart.fix_simple_errors()
try:
current_invoice = InvoiceController.for_cart(current_cart.cart)
except ValidationError as ve:
return _checkout_errors(request, ve)
return redirect("invoice", current_invoice.invoice.id)
def _checkout_errors(request, errors):
error_list = []
for error in errors.error_list:
if isinstance(error, tuple):
error = error[1]
error_list.append(error)
data = {
"error_list": error_list,
}
return render(request, "registrasion/checkout_errors.html", data)
def invoice_access(request, access_code):
''' Redirects to an invoice for the attendee that matches the given access
code, if any.
If the attendee has multiple invoices, we use the following tie-break:
- If there's an unpaid invoice, show that, otherwise
- If there's a paid invoice, show the most recent one, otherwise
- Show the most recent invoid of all
Arguments:
access_code (castable to int): The access code for the user whose
invoice you want to see.
Returns:
redirect:
Redirect to the selected invoice for that user.
Raises:
Http404: If the user has no invoices.
'''
invoices = commerce.Invoice.objects.filter(
user__attendee__access_code=access_code,
).order_by("-issue_time")
if not invoices:
raise Http404()
unpaid = invoices.filter(status=commerce.Invoice.STATUS_UNPAID)
paid = invoices.filter(status=commerce.Invoice.STATUS_PAID)
if unpaid:
invoice = unpaid[0] # (should only be 1 unpaid invoice?)
elif paid:
invoice = paid[0] # Most recent paid invoice
else:
invoice = invoices[0] # Most recent of any invoices
return redirect("invoice", invoice.id, access_code)
def invoice(request, invoice_id, access_code=None):
''' Displays an invoice.
This view is not authenticated, but it will only allow access to either:
the user the invoice belongs to; staff; or a request made with the correct
access code.
Arguments:
invoice_id (castable to int): The invoice_id for the invoice you want
to view.
access_code (Optional[str]): The access code for the user who owns
this invoice.
Returns:
render:
Renders ``registrasion/invoice.html``, with the following
data::
{
"invoice": models.commerce.Invoice(),
}
Raises:
Http404: if the current user cannot view this invoice and the correct
access_code is not provided.
'''
current_invoice = InvoiceController.for_id_or_404(invoice_id)
if not current_invoice.can_view(
user=request.user,
access_code=access_code,
):
raise Http404()
data = {
"invoice": current_invoice.invoice,
}
return render(request, "registrasion/invoice.html", data)
def _staff_only(user):
''' Returns true if the user is staff. '''
return user.is_staff
@user_passes_test(_staff_only)
def manual_payment(request, invoice_id):
''' Allows staff to make manual payments or refunds on an invoice.
This form requires a login, and the logged in user needs to be staff.
Arguments:
invoice_id (castable to int): The invoice ID to be paid
Returns:
render:
Renders ``registrasion/manual_payment.html`` with the following
data::
{
"invoice": models.commerce.Invoice(),
"form": form, # A form that saves a ``ManualPayment``
# object.
}
'''
FORM_PREFIX = "manual_payment"
current_invoice = InvoiceController.for_id_or_404(invoice_id)
form = forms.ManualPaymentForm(
request.POST or None,
prefix=FORM_PREFIX,
)
if request.POST and form.is_valid():
form.instance.invoice = current_invoice.invoice
form.instance.entered_by = request.user
form.save()
current_invoice.update_status()
form = forms.ManualPaymentForm(prefix=FORM_PREFIX)
data = {
"invoice": current_invoice.invoice,
"form": form,
}
return render(request, "registrasion/manual_payment.html", data)
@user_passes_test(_staff_only)
def refund(request, invoice_id):
''' Marks an invoice as refunded and requests a credit note for the
full amount paid against the invoice.
This view requires a login, and the logged in user must be staff.
Arguments:
invoice_id (castable to int): The ID of the invoice to refund.
Returns:
redirect:
Redirects to ``invoice``.
'''
current_invoice = InvoiceController.for_id_or_404(invoice_id)
try:
current_invoice.refund()
messages.success(request, "This invoice has been refunded.")
except ValidationError as ve:
messages.error(request, ve)
return redirect("invoice", invoice_id)
@user_passes_test(_staff_only)
def credit_note(request, note_id, access_code=None):
''' Displays a credit note.
If ``request`` is a ``POST`` request, forms for applying or refunding
a credit note will be processed.
This view requires a login, and the logged in user must be staff.
Arguments:
note_id (castable to int): The ID of the credit note to view.
Returns:
render or redirect:
If the "apply to invoice" form is correctly processed, redirect to
that invoice, otherwise, render ``registration/credit_note.html``
with the following data::
{
"credit_note": models.commerce.CreditNote(),
"apply_form": form, # A form for applying credit note
# to an invoice.
"refund_form": form, # A form for applying a *manual*
# refund of the credit note.
"cancellation_fee_form" : form, # A form for generating an
# invoice with a
# cancellation fee
}
'''
note_id = int(note_id)
current_note = CreditNoteController.for_id_or_404(note_id)
apply_form = forms.ApplyCreditNoteForm(
current_note.credit_note.invoice.user,
request.POST or None,
prefix="apply_note"
)
refund_form = forms.ManualCreditNoteRefundForm(
request.POST or None,
prefix="refund_note"
)
cancellation_fee_form = forms.CancellationFeeForm(
request.POST or None,
prefix="cancellation_fee"
)
if request.POST and apply_form.is_valid():
inv_id = apply_form.cleaned_data["invoice"]
invoice = commerce.Invoice.objects.get(pk=inv_id)
current_note.apply_to_invoice(invoice)
messages.success(
request,
"Applied credit note %d to invoice." % note_id,
)
return redirect("invoice", invoice.id)
elif request.POST and refund_form.is_valid():
refund_form.instance.entered_by = request.user
refund_form.instance.parent = current_note.credit_note
refund_form.save()
messages.success(
request,
"Applied manual refund to credit note."
)
refund_form = forms.ManualCreditNoteRefundForm(
prefix="refund_note",
)
elif request.POST and cancellation_fee_form.is_valid():
percentage = cancellation_fee_form.cleaned_data["percentage"]
invoice = current_note.cancellation_fee(percentage)
messages.success(
request,
"Generated cancellation fee for credit note %d." % note_id,
)
return redirect("invoice", invoice.invoice.id)
data = {
"credit_note": current_note.credit_note,
"apply_form": apply_form,
"refund_form": refund_form,
"cancellation_fee_form": cancellation_fee_form,
}
return render(request, "registrasion/credit_note.html", data)
@user_passes_test(_staff_only)
def amend_registration(request, user_id):
''' Allows staff to amend a user's current registration cart, and etc etc.
'''
user = User.objects.get(id=int(user_id))
current_cart = CartController.for_user(user)
items = commerce.ProductItem.objects.filter(
cart=current_cart.cart,
).select_related("product")
initial = [{"product": i.product, "quantity": i.quantity} for i in items]
StaffProductsFormSet = forms.staff_products_formset_factory(user)
formset = StaffProductsFormSet(
request.POST or None,
initial=initial,
prefix="products",
)
for item, form in zip(items, formset):
queryset = inventory.Product.objects.filter(id=item.product.id)
form.fields["product"].queryset = queryset
voucher_form = forms.VoucherForm(
request.POST or None,
prefix="voucher",
)
if request.POST and formset.is_valid():
pq = [
(f.cleaned_data["product"], f.cleaned_data["quantity"])
for f in formset
if "product" in f.cleaned_data and
f.cleaned_data["product"] is not None
]
try:
current_cart.set_quantities(pq)
return redirect(amend_registration, user_id)
except ValidationError as ve:
for ve_field in ve.error_list:
product, message = ve_field.message
for form in formset:
if "product" not in form.cleaned_data:
# This is the empty form.
continue
if form.cleaned_data["product"] == product:
form.add_error("quantity", message)
if request.POST and voucher_form.has_changed() and voucher_form.is_valid():
try:
current_cart.apply_voucher(voucher_form.cleaned_data["voucher"])
return redirect(amend_registration, user_id)
except ValidationError as ve:
voucher_form.add_error(None, ve)
ic = ItemController(user)
data = {
"user": user,
"paid": ic.items_purchased(),
"cancelled": ic.items_released(),
"form": formset,
"voucher_form": voucher_form,
}
return render(request, "registrasion/amend_registration.html", data)
@user_passes_test(_staff_only)
def extend_reservation(request, user_id, days=7):
''' Allows staff to extend the reservation on a given user's cart.
'''
user = User.objects.get(id=int(user_id))
cart = CartController.for_user(user)
cart.extend_reservation(datetime.timedelta(days=days))
return redirect(request.META["HTTP_REFERER"])
Email = namedtuple(
"Email",
("subject", "body", "from_email", "recipient_list"),
)
@user_passes_test(_staff_only)
def invoice_mailout(request):
''' Allows staff to send emails to users based on their invoice status. '''
category = request.GET.getlist("category", [])
product = request.GET.getlist("product", [])
status = request.GET.get("status")
form = forms.InvoiceEmailForm(
request.POST or None,
category=category,
product=product,
status=status,
)
emails = []
if form.is_valid():
emails = []
for invoice in form.cleaned_data["invoice"]:
# datatuple = (subject, message, from_email, recipient_list)
from_email = form.cleaned_data["from_email"]
subject = form.cleaned_data["subject"]
body = Template(form.cleaned_data["body"]).render(
Context({
"invoice": invoice,
"user": invoice.user,
})
)
recipient_list = [invoice.user.email]
emails.append(Email(subject, body, from_email, recipient_list))
if form.cleaned_data["action"] == forms.InvoiceEmailForm.ACTION_SEND:
# Send e-mails *ONLY* if we're sending.
send_mass_mail(emails)
messages.info(request, "The e-mails have been sent.")
data = {
"form": form,
"emails": emails,
}
return render(request, "registrasion/invoice_mailout.html", data)
@user_passes_test(_staff_only)
def badge(request, user_id):
''' Renders a single user's badge (SVG). '''
user_id = int(user_id)
user = User.objects.get(pk=user_id)
rendered = render_badge(user)
response = HttpResponse(rendered)
response["Content-Type"] = "image/svg+xml"
response["Content-Disposition"] = 'inline; filename="badge.svg"'
return response
def badges(request):
''' Either displays a form containing a list of users with badges to
render, or returns a .zip file containing their badges. '''
category = request.GET.getlist("category", [])
product = request.GET.getlist("product", [])
status = request.GET.get("status")
form = forms.InvoicesWithProductAndStatusForm(
request.POST or None,
category=category,
product=product,
status=status,
)
if form.is_valid():
response = HttpResponse()
response["Content-Type"] = "application.zip"
response["Content-Disposition"] = 'attachment; filename="badges.zip"'
z = zipfile.ZipFile(response, "w")
for invoice in form.cleaned_data["invoice"]:
user = invoice.user
badge = render_badge(user)
z.writestr("badge_%d.svg" % user.id, badge.encode("utf-8"))
return response
data = {
"form": form,
}
return render(request, "registrasion/badges.html", data)
def render_badge(user):
''' Renders a single user's badge. '''
data = {
"user": user,
}
t = loader.get_template('registrasion/badge.svg')
return t.render(data)
|