django-1.11

    1熱度

    1回答

    我有一個inlineformset到CreateView存儲相關的模型記錄。 forms.py class BusinessForm(ModelForm): class Meta: model = Business exclude =() BusinessAddressFormSet = inlineformset_factory( Business,

    0熱度

    2回答

    Auth用戶我使用Django 1.11 我有一個商業模式。 class Business(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) name = models.CharField(max_length=200) business_type = models.Fore

    0熱度

    1回答

    I'like代表news_list的名單,結果應該像使用2個循環以下樣式: 組別 - info_record 1 - info_record 2 產品組別 - info_record 3 問題是,內部循環{%for p_list.p.name%}總是沒有任何事情發生,同時可以正確檢索外部循環{%for p_category%}。 HTML模板文件如下所示, {% block content %}

    -1熱度

    1回答

    我用這個驗證: class MyValidationForm(forms.Form): title = forms.CharField() body = forms.Textarea() taxonomy = forms.IntegerField() ,這是我基於類的觀點: class blog_createpost(dashboardBaseViews):

    1熱度

    1回答

    當調用 from django.core.management import call_command call_command('dbbackup', compress=True, interactive=False) 我得到: CommandConnectorError: Error running: pg_dump xxx --host=localhost --port=xxx --u

    1熱度

    1回答

    試圖使用Django-filter基於類的視圖FilterView但我在模板中呈現過濾器時遇到問題。看起來這個過濾器不是在這個領域。 DOCS:https://django-filter.readthedocs.io/en/master/guide/usage.html#generic-view-configuration 編輯:看來,鑑於get(self...)功能永遠不會被調用。我在get方法

    -2熱度

    1回答

    暈,我試圖用filefield上傳文件。但我總是失敗。當執行語句form.errors.as_data()時,瀏覽器返回'tempfile'。我已經試圖從django文檔和一些django參考找到解決方案。但是,仍然無法解決它。 ( 這裏是我的view.py def dataprocessing(request): if request.method == 'POST': form =

    0熱度

    1回答

    我想爲我的一個項目構建一個複雜的(對我來說)查詢。 Django版本是1.11.4,PostgreSQL版本是9.6。 這裏是模型。 class Event(models.Model): ... name = models.CharField(max_length=256) classification = models.ForeignKey("events.Clas

    0熱度

    1回答

    我使用Django 1.11 我創建了一個Form並使用Class based view創建一個記錄並保存到數據庫中。 商務/ models.py class BusinessType(models.Model): title = models.CharField(max_length=100) created = models.DateTimeField('date crea

    1熱度

    2回答

    我有一個Django模型,它包含一個帶日期的唯一記錄。我目前正在將記錄計入日期範圍內,例如X號碼已經過了今天的日期,X會在接下來的10天內發生,X會在接下來的30天內發生。 下面的代碼是我目前使用的代碼,它將所有值從record.objects.all()查詢中拉回模型,然後遍歷每個對象以計算日期時間增量並增加相關計數器。 for x in records: if x.date is N