如果citizen.nizo.name == category.name <a>
应该工作,我不能使用i .nizo.name
我one_category.html
{% for i in citizen %}
{% if i.nizo == category.name %}
<p>if</p>
<a href="{% url 'citizen' i.slug %}"><h3> {{ i.name }} - haqida malumuot</h3> </a> <br>
{% else %}
<p>else</p>
{% endif %}
{% endfor %}
我models.py
class Citizen (models.Model) :
name = models.CharField(max_length=255, verbose_name= "F.I.SH",blank=True,null=True) #widget=models.TextInput(attrs={'class':'form-input'})
tugilgan_sanasi = models.DateField(max_length=255, verbose_name= "Tug'ilgan sanasi",blank=True,null=True)
slug = models.SlugField(max_length=255, unique=True,verbose_name= "Slug")
yashash_manzili = models.CharField(max_length=240, verbose_name= "Yashah manzili",blank=True,null=True)
content = models.TextField(verbose_name ="Текст статьи",blank=True)
photo = models.ImageField(upload_to="photos/%Y/%m/%d/", verbose_name="Izoh",blank=True,null=True)
is_published = models.BooleanField(verbose_name= "Organilgan/Organilmagan")
time_create = models.DateTimeField(auto_now_add=True, verbose_name="Время создания",blank=True,null=True)
time_update = models.DateTimeField(auto_now=True, verbose_name="Время изменения",blank=True,null=True)
nizo_shaxs =models.CharField(max_length=240, verbose_name="Nizoloshyatgan Shaxs F.I.SH",blank=True,null=True)
nizo = models.ForeignKey('Category',on_delete=models.PROTECT, null=True,blank=True, verbose_name ="Nizo не выбрана")
mah = models.ForeignKey('Mahalla',on_delete=models.PROTECT,null=True,blank=True, verbose_name= "Mahalla не выбрана")
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse('iib:citizen', kwargs={'citizen_slug': self.slug})
class Category(models.Model):
name = models.CharField(max_length=100, db_index=True, verbose_name="Nizo")
slug = models.SlugField(max_length=255, unique=True, db_index=True, verbose_name="URL")
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse('iib:category', kwargs={'nizo_slug': self.pk})
class Meta:
verbose_name = 'Nizo'
verbose_name_plural = 'Nizo'
我views.py
def show_one_category(request,nizo_slug:str):
citizen = Citizen.objects.all()
category = get_object_or_404(Category, slug=nizo_slug)
context = {
'category':category,
'citizen':citizen,
}
return render(request, 'main/one_category.html', context)
创建一个通用Windows项目并检查是否可以正确运行该项目
更新Windows到1903版
加载visual studio并运行一个通用Windows项目。通过运行项目来检查它是否有效。
创建一个新的Unity项目。导航到您的项目并选择build以创建.sln文件。注意:不是Build and Release。确保AppX包含项目文件夹中子目录下的文件副本。
复制3个dll并将它们粘贴到您的项目exe所在的AppX目录中。它们是:vccorlib140_app.dll, VCRUNTIME140_APP.dll和MSVCP140_APP.dll。
在APPX文件夹中测试您的exe,检查是否没有关于dll的投诉。
返回Unity,选择UWP,然后选择build and run。