This commit is contained in:
baoliang 2018-09-06 11:17:19 +08:00
parent 55c7b6e5a5
commit e162753517
3 changed files with 6 additions and 10 deletions

View File

@ -15,8 +15,9 @@ class Category(models.Model):
(u'基础地理数据', u'基础地理数据'), (u'基础地理数据', u'基础地理数据'),
(u'遥感数据', u'遥感数据'), (u'遥感数据', u'遥感数据'),
(u'G214国道', u'G214国道'), (u'G214国道', u'G214国道'),
(u'花石峡冻土观测站', u'花石峡冻土观测站'), (u'冻土观测基地(旧)', u'冻土观测基地(旧)'),
(u'青海冻土观测基地', u'青海冻土观测基地'), (u'冻土观测基地(新)', u'冻土观测基地(新)'),
(u'施工设计资料', u'施工设计资料'),
) )
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)

View File

@ -9,7 +9,7 @@
<a href="{% url 'metadata_index' %}?category=2">遥感影像</a> <a href="{% url 'metadata_index' %}?category=2">遥感影像</a>
</li> </li>
<li> <li>
<a href="{% url 'sources' %}">施工设计资料</a> <a href="{% url 'metadata_index' %}%category=6">施工设计资料</a>
</li> </li>
<li> <li>
<a href="{% url 'metadata_index' %}?category=3">G214国道</a> <a href="{% url 'metadata_index' %}?category=3">G214国道</a>

View File

@ -20,24 +20,19 @@ def index(request):
category = request.GET.get('category', 1) category = request.GET.get('category', 1)
if category == '1': if category == '1':
metadatas = Metadata.objects.filter(category__name=u'基础地理数据').all() metadatas = Metadata.objects.filter(category__name=u'基础地理数据').all()
elif category == '2': elif category == '2':
metadatas = Metadata.objects.filter(category__name=u'遥感数据').all() metadatas = Metadata.objects.filter(category__name=u'遥感数据').all()
elif category == '3': elif category == '3':
metadatas = Metadata.objects.filter(category__name=u'G214国道').all() metadatas = Metadata.objects.filter(category__name=u'G214国道').all()
elif category == '4': elif category == '4':
metadatas = Metadata.objects.filter(category__name=u'冻土观测基地(旧)').all()
metadatas = Metadata.objects.filter(category__name=u'花石峡冻土观测站').all()
elif category == '5': elif category == '5':
metadatas = Metadata.objects.filter(category__name=u'冻土观测基地(新)').all()
metadatas = Metadata.objects.filter(category__name=u'青海冻土观测基地').all()
else: else:
metadatas = Metadata.objects.all() metadatas = Metadata.objects.all()