100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten
logo-home
DJANGO EXAM; QUESTIONS AND ANSWERS €13,28
In winkelwagen

Tentamen (uitwerkingen)

DJANGO EXAM; QUESTIONS AND ANSWERS

 0 keer verkocht
  • Vak
  • DJANGO
  • Instelling
  • DJANGO

DJANGO EXAM; QUESTIONS AND ANSWERS...

Voorbeeld 3 van de 17  pagina's

  • 26 juli 2024
  • 17
  • 2023/2024
  • Tentamen (uitwerkingen)
  • Vragen en antwoorden
  • DJANGO
  • DJANGO
avatar-seller
DJANGO EXAM; QUESTIONS AND ANSWERS How to check version - ANSWER python -m django --version Setting Up a Virtual Environment - ANSWER python virtualenv your_project_name activate virtual environment - ANSWER ./scripts/activate.bat ./scripts/activate How to create a project - ANSWER django-admin start project my project site How to start development server - ANSWER python manage.py run server How to change server IP/Port - ANSWER python manage.py run server 0:8080 settings=mysite.setting How to create a "blog" application - ANSWER python manage.py start app blog In which .py file do you define the data model? - ANSWER open the models.py and define the data schema How to import the Model? - ANSWER django.db.models.Model Write database model for "Post" with "title" field - ANSWER class Post(models. Model): title = models.CharField(max_length=250) In settings.py which setting tells Django that applications are active f or this site - ANSWER INSTALLED_APPS How to add "blog" application to INSTALLED_APPS - ANS WER INSTALLED_APPS = [ 'blog.apps.BlogConfig', ] The BlogConfig class is your application configuration. How to create an initial migration for your database "blog" site - ANSWER python manage.py make migrations blog Which command takes the migration name and returns their SQL without execut ing - ANSWER python manage.py sqlmigrate blog 0001 After "python manage.py make migrations" which command should you run for changes to apply? - ANSWER python manage.py migrate To invoke the Python shell - ANSWER python manage.py shell Creating a Superuser syntax - ANSWER python manage.py createsuperuser In Metadata, Sort result by "publish" field in descending order - ANSW ER class Meta: ordering = '-publish' Add database "Students" model to administration site. - ANSWER fro m .models import Students admin.site.register(Students) Replace admin.site.register() with decorator function? - ANSWER @admin.register() write class with decorator and customize the administration side. Database is "Post" and field to display is 'title' and 'status' - ANSWER @admin.register(Post) class PostAdmin(admin.ModelAdmin): list_display = ('title', 'status') Which attribute allows you to set the field for your model to display on the administration object list page. - ANSWER list_display = () Which attribute display filter options on the administration page for fi lter the result. - ANSWER list_filter =() Attribute for Search Field on Administration page. - ANSWER search_fields = () Which attribute prepopulates the 'slug' filed with the input of 'ti tle' on the Administration page. - ANSWER prepopulate_fields = {'slug': ('title',)} Attribute for raw id - ANSWER raw_id_fields = ('author') Attribute for date hierarchy on Administration page - ANSWER date_hierarchy =() admin.ModelAdmin order class - ANSWER ordering =() How to create the record and write it into the database with single operation, u se grno(1), first_name(Munawar) field. - ANSWER Students.objects.create(grno=1, first_name='Munawar') Write QuerySet for "all_student=" to returns all objects from Students list. - ANSWER all_posts = Post.objects.all() How to filter a QuerySet on "Post" database to return record on field 'publish_ year' field for the year '2020' - ANSWER Post.objects.filter(publish__year=2020) How to use order by in QuerySet on "Post" object field should be 'title' - ANSWER Post.objects.order_by('title') how to delete record from the 'Post' database if record id is '1' - ANSWER any_variable = Post.objects.get(id=1) any_variable .delete() define default manager name? - ANSWER objects = models.Manager() Create model manager class "Students" where their 'status' is 'active' - ANSWER class StudentsManager(models.Manager):

Dit zijn jouw voordelen als je samenvattingen koopt bij Stuvia:

Bewezen kwaliteit door reviews

Bewezen kwaliteit door reviews

Studenten hebben al meer dan 850.000 samenvattingen beoordeeld. Zo weet jij zeker dat je de beste keuze maakt!

In een paar klikken geregeld

In een paar klikken geregeld

Geen gedoe — betaal gewoon eenmalig met iDeal, creditcard of je Stuvia-tegoed en je bent klaar. Geen abonnement nodig.

Direct to-the-point

Direct to-the-point

Studenten maken samenvattingen voor studenten. Dat betekent: actuele inhoud waar jij écht wat aan hebt. Geen overbodige details!

Veelgestelde vragen

Wat krijg ik als ik dit document koop?

Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.

Tevredenheidsgarantie: hoe werkt dat?

Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.

Van wie koop ik deze samenvatting?

Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper luzlinkuz. Stuvia faciliteert de betaling aan de verkoper.

Zit ik meteen vast aan een abonnement?

Nee, je koopt alleen deze samenvatting voor €13,28. Je zit daarna nergens aan vast.

Is Stuvia te vertrouwen?

4,6 sterren op Google & Trustpilot (+1000 reviews)

Afgelopen 30 dagen zijn er 69252 samenvattingen verkocht

Opgericht in 2010, al 15 jaar dé plek om samenvattingen te kopen

Begin nu gratis
€13,28
  • (0)
In winkelwagen
Toegevoegd