Results of 1 - 10 of about 27 for article (0.028 sec.)
- 多対多 (many-to-many) 関係 — Django 4.0.6 ドキュメント 12837
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
ionship, use ManyToManyField . In this example, an Article can be published in multiple Publication objects, ...
and a Publication has multiple Article objects: from django.db import models class Public ...
] def __str__ ( self ): return self . title class Article ( models . Model ): headline = models . CharField ...
le = 'Science Weekly' ) >>> p3 . save () Create an Article : >>> a1 = Article ( headline = 'Django lets you b ...
-
https://man.plustar.jp/django/topics/db/examples/many_to_many.html
- [similar]
- 多対一 (many-to-one) 関係 — Django 4.0.6 ドキュメント 12804
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
" % ( self . first_name , self . last_name ) class Article ( models . Model ): headline = models . CharField ...
= 'paul@example.com' ) >>> r2 . save () Create an Article: >>> from datetime import date >>> a = Article ( i ...
foreign key relationship. For example, creating an Article with unsaved Reporter raises ValueError : >>> r3 = ...
_name = 'Smith' , email = 'john@example.com' ) >>> Article . objects . create ( headline = "This is a test" , ...
-
https://man.plustar.jp/django/topics/db/examples/many_to_one.html
- [similar]
- Generic date ビュー — Django 4.0.6 ドキュメント 10862
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
ジの例のいくつかは、 myapp/models.py 内で下記の通り Article モデルが定義されていると仮定します: from django.db ...
mport models from django.urls import reverse class Article ( models . Model ): title = models . CharField ( m ...
) def get_absolute_url ( self ): return reverse ( 'article-detail' , kwargs = { 'pk' : self . pk }) ArchiveIn ...
s import ArchiveIndexView from myapp.models import Article urlpatterns = [ path ( 'archive/' , ArchiveIndexVi ...
-
https://man.plustar.jp/django/ref/class-based-views/generic-date-based.html
- [similar]
- Django の概要 — Django 4.0.6 ドキュメント 10171
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
ef __str__ ( self ): return self . full_name class Article ( models . Model ): pub_date = models . DateField ...
ed from our "news" app >>> from news.models import Article , Reporter # No reporters are in the system yet. > ...
porter matching query does not exist . # Create an article. >>> from datetime import date >>> a = Article ( p ...
'Yeah.' , reporter = r ) >>> a . save () # Now the article is in the database. >>> Article . objects . all () ...
-
https://man.plustar.jp/django/intro/overview.html
- [similar]
- Generic display ビュー — Django 4.0.6 ドキュメント 9397
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
django.views.generic.detail import DetailView from articles.models import Article class ArticleDetailView ( D ...
etailView ): model = Article def get_context_data ( self , ** kwargs ): context ...
myapp/urls.py : from django.urls import path from article.views import ArticleDetailView urlpatterns = [ pat ...
h ( '<slug:slug>/' , ArticleDetailView . as_view (), name = 'article-detail' ), ...
-
https://man.plustar.jp/django/ref/class-based-views/generic-display.html
- [similar]
- フォームセット (Formset) — Django 4.0.6 ドキュメント 9117
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
えましょう。 >>> from django import forms >>> class ArticleForm ( forms . Form ): ... title = forms . CharFiel ...
が一度に複数の記事を作成できるようにしたいとします。 ArticleForm からフォームセットを生成するには、次のようにし ...
。 >>> from django.forms import formset_factory >>> ArticleFormSet = formset_factory ( ArticleForm ) You now h ...
ave created a formset class named ArticleFormSet . Instantiating the formset gives you the a ...
-
https://man.plustar.jp/django/topics/forms/formsets.html
- [similar]
- The "sites" framework — Django 4.0.6 ドキュメント 8525
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
inment. But sometimes editors wanted to publish an article on both sites. The naive way of solving the proble ...
s the content duplication: Both sites use the same article database, and an article is associated with one or ...
gy, that's represented by a ManyToManyField in the Article model: from django.contrib.sites.models import Sit ...
e from django.db import models class Article ( models . Model ): headline = models . CharField ...
-
https://man.plustar.jp/django/ref/contrib/sites.html
- [similar]
- モデルからフォームを作成する — Django 4.0.6 ドキュメント 8443
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
orms import ModelForm >>> from myapp.models import Article # Create the form class. >>> class ArticleForm ( M ...
odelForm ): ... class Meta : ... model = Article ... fields = [ 'pub_date' , 'headline' , 'content' ...
, 'reporter' ] # Creating a form to add an article. >>> form = ArticleForm () # Creating a form to ch ...
ange an existing article. >>> article = Article . objects . get ( pk = 1 ) ...
-
https://man.plustar.jp/django/topics/forms/modelforms.html
- [similar]
- Base views — Django 4.0.6 ドキュメント 8344
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
django.views.generic.base import TemplateView from articles.models import Article class HomePageView ( Templa ...
. get_context_data ( ** kwargs ) context [ 'latest_articles' ] = Article . objects . all ()[: 5 ] return cont ...
django.views.generic.base import RedirectView from articles.models import Article class ArticleCounterRedirec ...
manent = False query_string = True pattern_name = 'article-detail' def get_redirect_url ( self , * args , ** ...
-
https://man.plustar.jp/django/ref/class-based-views/base.html
- [similar]
- Django 1.4 documentation 8278
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
_unicode__ ( self ): return self . full_name class Article ( models . Model ): pub_date = models . DateTimeFi ...
rt します。 >>> from news.models import Reporter , Article .. # No reporters are in the system yet. # まだシス ...
ter matching query does not exist . .. # Create an article. # Article を作成します。 >>> from datetime import ...
datetime >>> a = Article ( pub_date = datetime . now (), headline = 'Django ...
-
https://man.plustar.jp/django/contents.html
- [similar]