gpt4 book ai didi

django - ** 之后的 _filter_or_exclude() 参数必须是映射,而不是 ReverseManyRelatedObjectsDescriptor

转载 作者:行者123 更新时间:2023-12-03 21:40:04 26 4
gpt4 key购买 nike

为什么我收到这个错误?

我的模型.py:

    # -*- coding: utf-8 -*-
from django.db import models
from sitem.ligler.models import *
from sitem.takimlar.models import *
from sitem.futbolcular.models import *
from sitem.stadyumlar.models import *
from sitem.ligmaclari.models import *

DAKIKA_SECIMLERI = [(str(dk), str(dk)) for dk in range(1, 121)]
KART_SECIMLER = (
('SK','Sari Kart'),
('SKK','Sarıdan Kırmızı Kart'),
('DKK','Direk Kırmızı Kart')
)
# Create your models here.
class EvSahibiKartlar(models.Model):
mac = models.ForeignKey(Ligmaclari)
ev_sahibi_oyuncu = models.ForeignKey(Futbolcular, limit_choices_to = Ligmaclari.ev_sahibi_takim_kadro, related_name='Ev Sahibi Oyuncu')
kart_tipi = models.CharField(max_length=50, choices=KART_SECIMLER)
dakika = models.PositiveSmallIntegerField(max_length=4, choices=DAKIKA_SECIMLERI)

def __unicode__(self):
return self.mac

class KonukKartlar(models.Model):
mac = models.ForeignKey(Ligmaclari)
konuk_takim_oyuncu = models.ForeignKey(Futbolcular, limit_choices_to = Ligmaclari.konuk_takim_kadro, related_name='Konuk Takım Oyuncu')
kart_tipi = models.CharField(max_length=50, choices=KART_SECIMLER)
dakika = models.PositiveSmallIntegerField(max_length=4, choices=DAKIKA_SECIMLERI)

def __unicode__(self):
return self.mac

我的 admin.py:
from sitem.kartlar.models import *
from django.contrib import admin
from django import forms
from django.forms import ModelForm

class EvSahibiKartlarAdmin(admin.ModelAdmin):
ordering = ['mac']

class KonukKartlarAdmin(admin.ModelAdmin):
ordering = ['mac']
admin.site.register(EvSahibiKartlar,EvSahibiKartlarAdmin)
admin.site.register(KonukKartlar,KonukKartlarAdmin)

其实我想做过滤外键...

最佳答案

limit_choices_to 没有被传递 a valid value

关于django - ** 之后的 _filter_or_exclude() 参数必须是映射,而不是 ReverseManyRelatedObjectsDescriptor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6787689/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com