On Sun, May 3, 2020 at 7:34 AM Vikram Jaiswal <
vikramkumarjaiswal221...@gmail.com> wrote:

> above is the image of the error
> admin.py
> from django.contrib import admin
> from travello.models import Destination
>
>
>
> class ContactAdmin(admin.ModelAdmin):
> Clist_display = [ 'name', 'department', 'lalal']
> # Register your models here.
> admin.site.register(Destination,ContactAdmin)
>
>
> models.py
> from django.db import models
>
> # Create your models here.
> class Destination(models.Model):
> #id : int
> name : models.CharField(max_length=100)#str
> img : models.ImageField(upload_to='pics')#str
> desc : models.CharField(max_length=100)#str
> price : models.IntegerField()#int
> offer : models.BooleanField(default=False)#bool
>
>
> When i try to use
> python manage.py makemigrations
> then in 0001_inital.py only contains id attribute.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f60acf9d-d64d-4792-a9c1-5585d40758e6%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f60acf9d-d64d-4792-a9c1-5585d40758e6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

To create the fields in Python models, we have to set the name of the
attributes equal to the class of the field type.  In simpler terms, using
your model class and just the name attribute:

from django.db import models


class Destination(models.Model):
name = models.CharField(max_length=100)

Try setting the rest of the attributes using the assignment operator ('='),
then run migrations again.  You should see the fields in the admin.

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK85E13zVaOHuJA%2BMegWXq%2BSx%2BY8%2B7ymoUW4-9F-msikmw%40mail.gmail.com.

Reply via email to