Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. urlpatterns = [
  2. url(r'^admin/', admin.site.urls),
  3. url(r'^batches/', include('batches.urls')),
  4. url(r'^screenings/', include('screenings.urls')),
  5. url(r'^individuals/', include('batches.urls')),
  6. url(r'^businessnames', include('batches.urls')),
  7. ]
  8.  
  9. from __future__ import unicode_literals
  10. from .models import BusinessName
  11. from .models import Individuals
  12. from .models import Batches
  13.  
  14. from django.shortcuts import render
  15. from django.http import HttpResponse
  16.  
  17. # Create your views here.
  18. def index(request):
  19. all_Batches = Batches.objects.all()
  20. html = ''
  21. for batch in all_Batches:
  22. url = '/batches/' + str(batch.id) + '/'
  23. html += '<a href="#"' + url + '">' + str(batch.FileName)+ '</a><br>'
  24. return HttpResponse(html)
  25.  
  26. def detail(request, batches_id): #parametrul asta batches_id tr sa se gaseasca in urls.py din app
  27. return HttpResponse("<h2>Details for Batches ID:" + str(batches_id) + "</h2")
  28.  
  29.  
  30. def index_businessname(request):
  31. all_BusinessNames = BusinessName.objects.all()
  32. html1 = ''
  33. for bn in all_BusinessNames:
  34. url = '/businessnames/' + str(bn.id) + '/'
  35. html1 += '<a href="#"' + url + '">' + bn.FullName + '</a><br>'
  36. return HttpResponse(html1)
  37.  
  38. def detail_businessname(request, businessname_id):
  39. return HttpResponse("<h2>Details for Business Names ID:" + str(businessname_id) + "</h2")
  40.  
  41. def index_individual(request):
  42. all_individuals = Individuals.objects.all()
  43. html2 = ''
  44. for i in all_individuals:
  45. url = '/individuals/' + i.id + '/'
  46. html2 += '<a href="#"' + url + '">' + i.FullName + '</a><br>'
  47. return HttpResponse(html2)
  48.  
  49.  
  50. def detail_individual(request, individuals_id):
  51. return HttpResponse("<h2>Details for Individual Names ID:" + str(individuals_id)+ "</h2")
  52.  
  53. urlpatterns = [
  54. # /batches/
  55. url(r'^$', views.index, name='index'),
  56. # /batches/2
  57. url(r'^(?P<batches_id>[0-9]+)/$',views.detail, name="detail"),
  58.  
  59. # businessname/1
  60. url(r'^$',views.index_businessname, name="index_businessname"),
  61. # businessname/1
  62. url(r'^(?P<businessname_id>[0-9]+)/$', views.detail_businessname, name="detail_businessname"),
  63.  
  64.  
  65. # individuals/1
  66. url(r'^$', views.index_individual, name="index_individuals"),
  67. # individuals/1
  68. url(r'^(?P<individuals_id>[0-9]+)/$', views.detail_individual, name="detail_individual"),
  69. ]
  70.  
  71. class Batches(models.Model):
  72. BatchNumber = models.IntegerField(null=True)
  73. FileName= models.CharField(max_length=250)
  74. UploadedDate= models.DateField(max_length=250)
  75. UploadedBy = models.CharField(max_length=250)
  76. NumberOfRows= models.IntegerField(null=True)
  77. Hits= models.IntegerField(null=True)
  78. Status= models.CharField(max_length=250)
  79.  
  80. class Meta:
  81. verbose_name_plural = "Batches"
  82.  
  83. def __str__(self):
  84. return self.FileName + '- ' + str(self.Hits) + '- ' + str(self.NumberOfRows) + '- ' + self.Status
  85.  
  86.  
  87.  
  88. class BusinessName(models.Model):
  89. AccountingCode = models.CharField(max_length=50)
  90. RefID = models.CharField(max_length=50, default="")
  91. FullName = models.CharField(max_length=250)
  92. Aliases = models.CharField(max_length=250)
  93. Address = models.CharField(max_length=500)
  94. City= models.CharField(max_length=50)
  95. ZipCode= models.IntegerField(null=True)
  96. State = models.CharField(max_length=250)
  97. Country= models.CharField(max_length=250)
  98. TypeOfSanction= models.CharField(max_length=250)
  99. Monitoring= models.CharField(max_length=50)
  100. BatchNumber= models.IntegerField(null=True) # tr pus automat
  101. FileName= models.CharField(max_length=250) # tr pus automat1
  102. UploadDate = models.DateField(max_length=250) # tr pus automat
  103. UploadBy= models.CharField(max_length=250) # tr pus automat
  104. Decision= models.CharField(max_length=250) # tr pus Ulterior
  105. Status= models.CharField(max_length=250) # tr pus automat
  106. EngineDecision= models.CharField(max_length=250) # tr pus automat
  107. WhoAdjudicated= models.CharField(max_length=250)
  108. DateOfAdjudication= models.CharField(max_length=250)
  109. SdnType = models.CharField(max_length=250) #Entity or Individual
  110.  
  111. class Meta:
  112. verbose_name_plural = "Business Names"
  113.  
  114. def __str__(self):
  115. return self.FullName + '-' + self.Address + '-' + self.City + '-' + '-' + self.State + '-' + self.Country
  116.  
  117. class Individuals(models.Model):
  118. AccountingCode = models.CharField(max_length=50)
  119. RefID = models.IntegerField(null=True)
  120. FullName = models.CharField(max_length=250)
  121. FirstName= models.CharField(max_length=250)
  122. Lastname= models.CharField(max_length=250)
  123. DayOfBirth = models.IntegerField(null=True)
  124. MonthOfBirth = models.IntegerField(null=True)
  125. YearOfBirth= models.IntegerField(null=True)
  126. FullDOB = models.DateField(max_length=250)
  127. Aliases = models.CharField(max_length=250)
  128. Address = models.CharField(max_length=500)
  129. City= models.CharField(max_length=50)
  130. ZipCode= models.IntegerField(null=True)
  131. State = models.CharField(max_length=250)
  132. Country= models.CharField(max_length=250)
  133. TypeOfSanction= models.CharField(max_length=250)
  134. Monitoring= models.CharField(max_length=50)
  135. BatchNumber= models.IntegerField(null=True) # tr pus automat
  136. FileName= models.CharField(max_length=250) # tr pus automat
  137. UploadDate= models.DateField(max_length=250) # tr pus automat
  138. UploadBy= models.CharField(max_length=250) # tr pus automat
  139. Decision= models.CharField(max_length=250) # tr pus Ulterior
  140. Status= models.CharField(max_length=250) # tr pus automat
  141. EngineDecision= models.CharField(max_length=250) # tr pus automat
  142. WhoAdjudicated= models.CharField(max_length=250)
  143. DateOfAdjudication= models.CharField(max_length=250)
  144. More= models.CharField(max_length=250)
  145. SdnType = models.CharField(max_length=250) #Entity or Individual
  146.  
  147. class Meta:
  148. verbose_name_plural = "Individuals"
  149.  
  150. def __str__(self):
  151. return self.FullName + '-' + self.Address + '-' + self.City + '-' + '-' + self.State + '-' + self.Country
  152.  
  153. url(r'^', include('batches.urls')),
  154.  
  155. urlpatterns = [
  156. url(r'^batches/$', views.index, name='index'),
  157. url(r'^batches/(?P<batches_id>[0-9]+)/$',views.detail, name="detail"),
  158. url(r'^businessname/$',views.index_businessname, name="index_businessname"),
  159. url(r'^businessname/(?P<businessname_id>[0-9]+)/$', views.detail_businessname, name="detail_businessname"),
  160. url(r'^individuals/$', views.index_individual, name="index_individuals"),
  161. url(r'^individuals/(?P<individuals_id>[0-9]+)/$', views.detail_individual, name="detail_individual"),
  162. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement