Try Django 1.9 – 7 of 38 – Model to Admin

Video is ready, Click Here to View ×


Try Django 1.9 – 7 of 38 – Model to Admin

** Try Django 1.9 ** is an introduction to Django version 1.9 by creating a simple, yet robust, Django blog. This series covers a variety of Django basics as well as Django 1.9 specific material. Learn more about the Django Web Framework here:

Subscribe to our channel:

Generally the topics will include:
– Django Project Setup
– Class Based Views (& some Function Based Views)
– Models, Model…

24 Comments

  1. this is my models.py
    class Post(models.Model):
    title = models.CharField(max_length=120)
    content = models.TextField()
    timestamp = models.DateTimeField(auto_now=True, auto_now_add=False)
    timestamp = models.DateTimeField(auto_now=False, auto_now_add=True)

    def __unicode__(self):
    return self.title

    def __str__(self):
    return self.title
    and this is my admin.py
    from django.contrib import admin

    # Register your models here.
    from posts.models import Post

    admin.site.register(Post)

    and still i am not able to see post section.

  2. Hi,

    I would like to be redirect to resource for a case where the admin or any app that extend it, could be used for case where internal staff are way more then 100 or such suppose to use the admin, let's say they could be thousand. Is it even possible(and manageable) to create an app that as admin characteristics( so extend it admin) but more "scalable"?

    I have read (mostly on OS) that the Admin app sin not been developed with this purpose in mind, but I read also that someone did it. Mitchel you also mentioned at the beginning of this tutorial that for more bigger project the approach is different.

    Could you indicate me some resources?

    I hope this question make sense.

    Thank you

  3. Thank you so much for sharing your knowledge. Excellent tutorial. I have a question, when I include the constructor method in the class def _init _ (self) I can not insert data in the Django form admin site does an error occur?

  4. the terminal keeps giving me the error 'posts doesn't look like a module path', heres the full error,
    ''' File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
    File "/Users/joshualandis/Desktop/Website2/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in _call_
    return self.application(environ, start_response)
    File "/Users/joshualandis/Desktop/Website2/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 158, in _call_
    self.load_middleware()
    File "/Users/joshualandis/Desktop/Website2/lib/python2.7/site-packages/django/core/handlers/base.py", line 51, in load_middleware
    mw_class = import_string(middleware_path)
    File "/Users/joshualandis/Desktop/Website2/lib/python2.7/site-packages/django/utils/module_loading.py", line 18, in import_string
    six.reraise(ImportError, ImportError(msg), sys.exc_info()[2])
    File "/Users/joshualandis/Desktop/Website2/lib/python2.7/site-packages/django/utils/module_loading.py", line 15, in import_string
    module_path, class_name = dotted_path.rsplit('.', 1)
    ImportError: posts doesn't look like a module path'''

  5. instead of sqlite i configured a mysql-python connector and migrated a mysql database instead.I did everything correctly but whenever i try to run the server,it says 'Syntax Error: keyword argument repeated(line 9)'Please help me i'm stucked :(.

  6. Hi. I get an error when I try to migrate after creating the class. The error looks like "TypeError: expected string or bytes-like object". I think it has something to do with "match = datetime_re.match(value)" but I'm not sure. I tried commenting out the timestamp and updated variables in my class but I still get the same error when I try to migrate.

Leave a Reply

Your email address will not be published.


*