Вопрос

This is the model, in which I want to search

class itemType(models.Model):
  partNumber = models.CharField(max_length = 12, null = True)
  designation = models.CharField(max_length = 200, null = True)
  timeCreate = models.DateTimeField() #auto update field, done in save method
  timeEdit = models.DateTimeField() #auto update field, done in save method

This is the view, I want to use to prepare my results

def itemtypedetails(request, itemtype_id):
  result = SearchQuerySet.models(itemType)
  #how can I filter the ID??
  return render_to_response('itemtypedetails.html', locals())

What I want is that my results are based on the model (itemType) and the ID of an itemType (itemtype_id).

I don't understand how to combine these two filters.
thanks for helping

Это было полезно?

Решение

Try to use .filter('your condition here')

result = SearchQuerySet.filter(ID=7).models(itemType)
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top