Thursday, November 29, 2018

objects.filter

helo, 
iam new for python.  

my : models.py

lass logbook_noc(models.Model):
idLogbookN = models.IntegerField(primary_key=True)
kodetiket = models.CharField(max_length=30)
CustName = models.CharField(max_length=30)
TanggalLo = models.DateTimeField()
DeskripsiLo = models.TextField()
StatusProgress = models.CharField(max_length=30)
PenangananLo = models.TextField()
TglUpdate = models.DateTimeField()


class Meta:
managed = False
db_table = 'logbook_noc'
def __str__(self):
return self.Id

  
 my: views.py

def home(request):
logbooks = logbook_noc.objects.filter(StatusProgress = '1 Pending' )
paginator = Paginator(logbooks, 8)
page = request.GET.get('page')
pb = paginator.get_page(page)
return render(request, 'blog/home.html', {'pb':pb})


how to add  one word again to filter like '2 On Progress'
i tray to logbooks = logbook_noc.objects.filter(StatusProgress = '1 Pending' or '2 On Progress' )
the output for status is only 1 Pending the 2 On Progress not display..

Thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6cdf4e2b-86a6-4db9-a39a-6dac4015a911%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment