Results of 1 - 10 of about 27 for Person (0.017 sec.)
- 素の SQL 文の実行 — Django 4.0.6 ドキュメント 14055
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
できます。以下のモデルについて考えてください: class Person ( models . Model ): first_name = models . CharFiel ...
以下のように独自の SQL を実行できます: >>> for p in Person . objects . raw ( 'SELECT * FROM myapp_person' ): ...
very exciting -- it's exactly the same as running Person.objects.all() . However, raw() has a bunch of othe ...
owerful. モデルのテーブル名称 この例で示したモデル Person のテーブル名はどのようにして得られたのでしょうか? ...
-
https://man.plustar.jp/django/topics/db/sql.html
- [similar]
- モデル — Django 4.0.6 ドキュメント 11866
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
簡単な例 ¶ 次の例では first_name と last_name を持つ Person というモデルを定義しています。 from django.db impo ...
rt models class Person ( models . Model ): first_name = models . CharFiel ...
性はデータベースのカラムに関連付けられます。 上記の Person モデルは以下のようなデータベースのテーブルを作成し ...
ます: CREATE TABLE myapp_person ( "id" serial NOT NULL PRIMARY KEY , "first_name" ...
-
https://man.plustar.jp/django/topics/db/models.html
- [similar]
- Django オブジェクトのシリアル化 — Django 4.0.6 ドキュメント 9973
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
ing two models: from django.db import models class Person ( models . Model ): first_name = models . CharFiel ...
max_length = 100 ) author = models . ForeignKey ( Person , on_delete = models . CASCADE ) Ordinarily, seria ...
ctable. However, if we add natural key handling to Person, the fixture becomes much more humane. To add natu ...
ral key handling, you define a default Manager for Person with a get_by_natural_key() method. In the case of ...
-
https://man.plustar.jp/django/topics/serialization.html
- [similar]
- Organization of the Django Project — Django 4.0.6 ドキュメント 9677
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
lowing restrictions apply to the role of Merger: A person must not simultaneously serve as a member of the t ...
pon taking up membership in the technical board. A person may serve in the roles of Releaser and Merger simu ...
ical board deems it necessary to select additional persons for such a role, occur as follows: Any member in ...
t of the DSF's Fellowship committee, may suggest a person for consideration. The technical board considers t ...
-
https://man.plustar.jp/django/internals/organization.html
- [similar]
- Django Utils — Django 4.0.6 ドキュメント 9397
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
ght invoke the method once more: # the model class Person ( models . Model ): def friends ( self ): # expens ...
e computation ... return friends # in the view: if person . friends (): ... And in the template you would ha ...
ve: {% for friend in person.friends %} Here, friends() will be called twice. S ...
ince the instance person in the view and the template are the same, decorat ...
-
https://man.plustar.jp/django/ref/utils.html
- [similar]
- マネージャ — Django 4.0.6 ドキュメント 9216
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
ように書きます。 from django.db import models class Person ( models . Model ): #... people = models . Manager ...
() このモデル例を使うと、 Person.objects は AttributeError 例外を起こしますが、 Per ...
son.people.all() と書けば、すべての Person オブジェクトのリストが得られます。 マネージャのカス ...
() . get_queryset () . filter ( role = 'E' ) class Person ( models . Model ): first_name = models . CharFiel ...
-
https://man.plustar.jp/django/topics/db/managers.html
- [similar]
- Django の admin サイト — Django 4.0.6 ドキュメント 8936
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
Reader , Editor , site = custom_admin_site ) class PersonAdmin ( admin . ModelAdmin ): pass You can't use th ...
l admin class in its __init__() method, e.g. super(PersonAdmin, self).__init__(*args, **kwargs) . You can us ...
ango.contrib import admin from myapp.models import Person class PersonForm ( forms . ModelForm ): class Meta ...
: model = Person exclude = [ 'name' ] class PersonAdmin ( admin . M ...
-
https://man.plustar.jp/django/ref/contrib/admin/index.html
- [similar]
- How to provide initial data for models — Django 4.0.6 ドキュメント 8591
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
As an example, though, here's what a fixture for a Person model might look like in JSON: [ { "model" : "myap ...
p.person" , "pk" : 1 , "fields" : { "first_name" : "John" , ...
"last_name" : "Lennon" } }, { "model" : "myapp.person" , "pk" : 2 , "fields" : { "first_name" : "Paul" , ...
ィクスチャだと以下のようになります: - model : myapp.person pk : 1 fields : first_name : John last_name : Lenn ...
-
https://man.plustar.jp/django/howto/initial-data.html
- [similar]
- QuerySet API リファレンス — Django 4.0.6 ドキュメント 8294
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
ls class City ( models . Model ): # ... pass class Person ( models . Model ): # ... hometown = models . Fore ...
ls . Model ): # ... author = models . ForeignKey ( Person , on_delete = models . CASCADE ) ... then a call t ...
uthor__hometown').get(id=4) will cache the related Person and the related City : # Hits the database with jo ...
erysets are the same, in terms of deferred fields: Person . objects . defer ( "age" , "biography" ) Person . ...
-
https://man.plustar.jp/django/ref/models/querysets.html
- [similar]
- Coding style — Django 4.0.6 ドキュメント 8064
- " + tagname + " "); } }); $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { va
...
g underscores instead of camelCase. Do this: class Person ( models . Model ): first_name = models . CharFiel ...
CharField ( max_length = 40 ) Don't do this: class Person ( models . Model ): FirstName = models . CharField ...
he fields and the class definition. Do this: class Person ( models . Model ): first_name = models . CharFiel ...
erbose_name_plural = 'people' Don't do this: class Person ( models . Model ): first_name = models . CharFiel ...
-
https://man.plustar.jp/django/internals/contributing/writing-code/coding-style.h...
- [similar]