Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Blog comment moderation and email
I am using django-blog-zinnia and I currently send the following emails: When a new comment is posted, email me When a new comment is posted, email the other commenters (ie: email everyone else who has posted a comment on that blog entry already) Here are the relevant Zinnia settings as they currently are: ZINNIA_MAIL_COMMENT_REPLY = True # email all commenters when a new comment is made ZINNIA_MAIL_COMMENT_NOTIFICATION_RECIPIENTS = [('example', 'example@example.com')] # email me when a new comment is made I want to moderate the comments to blog posts before they appear to ensure no spam / junk comments are being made. Zinnia provides a setting to do this, ie: ZINNIA_AUTO_MODERATE_COMMENTS = True. The problem with this setting is that when it is set to true, the above emails do not get sent even once the comment has been approved by using Django admin. I need the following: I need to receive an email when a new comment is awaiting moderation / approval. When the comment is approved, send all the other commenters an email. Is there a way to do this with existing Zinnia functionality? If not, how would this be done? -
Nested serializer does not serialize the 2nd serializer
I want to use nested serializer. I have followed the doc http://www.django-rest-framework.org/api-guide/relations/ Django REST 3.5.3 Django 1.9.12 Here is my models and serializers models class Budget(AbstractModelController): CANCELED = -1 CREATED = 0 QUOTATION = 1 INVOICED = 2 PART_PAID = 3 COMPLETED = 4 STATUS_CHOICES = ( (CANCELED, _("Canceled")), (CREATED, _("Created")), (QUOTATION, _("Quotation")), (INVOICED, _("Invoiced")), (PART_PAID, _("Part Paid")), (COMPLETED, _("Completed")) ) project = models.ForeignKey(Project, related_name="budgets", verbose_name=_("Project")) status = models.IntegerField(choices=STATUS_CHOICES, default=CREATED, verbose_name=_("Status")) name = models.CharField(max_length=200, verbose_name=_("Name")) value = models.DecimalField(max_digits=10, decimal_places=2, verbose_name=_("Value")) start_date = models.DateTimeField(verbose_name=_("Start date")) end_date = models.DateTimeField(verbose_name=_("End date")) class Meta: ordering = ("-id", ) def __str__(self): return "{}: {}".format(self.project.name, self.name) def get_absolute_url(self): return reverse_lazy("budget:detail", kwargs={"pk": self.id}) class Payment(AbstractModelController): class PaymentState(DjangoChoices): Paid = ChoiceItem("P") Unpaid = ChoiceItem("U") budget = models.ForeignKey(Budget, null=True, blank=True) description = models.CharField(max_length=255) ratio = models.SmallIntegerField(validators=[validate_boundary], verbose_name="Ratio(%)") state = models.CharField(max_length=1, choices=PaymentState.choices, validators=[PaymentState.validator]) serializers: class BudgetSerializer(serializers.ModelSerializer): project = ProjectSerializer() payments = PaymentSerializer(many=True, read_only=True) class Meta: model = Budget exclude = EXCLUDE_MODEL_CONTROLLER_FIELDS class PaymentSerializer(ModelControllerSerializerMixin): class Meta: model = Payment fields = [ "budget", "description", "ratio", "state", ] In the payment table. It has multiple records and refer to budget_id=1 { "budget": 1, "description": "First round", "ratio": 30, "state": "P" }, { "budget": 1, "description": "Second round", "ratio": 30, "state": "U" }, … -
Django Rest Framework - Posting multiple objects with many=True raise AttributeError 'list' object has no attribute 'get'
I am trying to override the create method of a ListCreateAPIView to be able to post multiple objects at the same time. The items are saved correctly but I keep getting an error. models.py : class Genre(models.Model): name = models.CharField(max_length=255, null=False, blank=False) category = models.ForeignKey(GenreCategory, related_name='genres', blank=True, null=True) active = models.BooleanField(default=False) views.py : class GenreList(generics.ListCreateAPIView): queryset = Genre.objects.all() serializer_class = GenreInputSerializer def list(self, request): queryset = self.get_queryset() serializer = GenreOutputSerializer(queryset, many=True, context={'request': request}) return Response(serializer.data) def create(self, request, *args, **kwargs): serializer = self.get_serializer(data=request.data, many=True) serializer.is_valid(raise_exception=True) self.perform_create(serializer) headers = self.get_success_headers(serializer.data) return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers) serializers.py : class GenreInputSerializer(serializers.ModelSerializer): class Meta: model = Genre fields = ('name', 'category',) POST request data (via the browsable API) : [ { "name": "Reggae", "category": null }, { "name": "Blues", "category": null } ] And here is the Traceback : Traceback (most recent call last): File "/Users/malastas/Documents/museekenv/lib/python3.4/site-packages/django/core/handlers/exception.py", line 39, in inner response = get_response(request) File "/Users/malastas/Documents/museekenv/lib/python3.4/site-packages/django/core/handlers/base.py", line 217, in _get_response response = self.process_exception_by_middleware(e, request) File "/Users/malastas/Documents/museekenv/lib/python3.4/site-packages/django/core/handlers/base.py", line 215, in _get_response response = response.render() File "/Users/malastas/Documents/museekenv/lib/python3.4/site-packages/django/template/response.py", line 109, in render self.content = self.rendered_content File "/Users/malastas/Documents/museekenv/lib/python3.4/site-packages/rest_framework/response.py", line 72, in rendered_content ret = renderer.render(self.data, accepted_media_type, context) File "/Users/malastas/Documents/museekenv/lib/python3.4/site-packages/rest_framework/renderers.py", line 701, in render context = self.get_context(data, accepted_media_type, renderer_context) File "/Users/malastas/Documents/museekenv/lib/python3.4/site-packages/rest_framework/renderers.py", … -
Nginx: right chmod permissions for sock file
Setting up a site using nginx and in the error logs it's denied permissions for the sock file. 2017/01/26 08:08:36 [crit] 1983#1983: *1 connect() to unix:///home/ubuntu/webapps/kenyabuzz/kb.sock failed (13: Permission denied) while connecting to upstream, client: 197.232.12.165, server: kenyabuzz.nation.news, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///home/ubuntu/webapps/kenyabuzz/kb.sock:", host: "kenyabuzz.nation.news", referrer: "http://kenyabuzz.nation.news/" What would be the optimal chmod rights to set for the sock file? -
Django, order database items by parent's field
In django I have this in my models: class WidgetData(models.Model): user = models.ForeignKey(User) priority = models.IntegerField(default=1) color = models.CharField(max_length=8, default="#188ae2") class WidgetAtomic(WidgetData): atomic = models.ForeignKey(Atomic) class WidgetNonAtomic(WidgetData): mutli = models.ForeignKey(MultiValued) Is it possible to use one query in order to retrieve and order both WidgetAtomic and WidgetNonAtomic by priority which is an inherited field? -
Django Rest Framwork Writable Nested serialization
I have used Writable Nested Serializer in my serializer and used create method like this: class OrderSerializer(serializers.ModelSerializer): billing = BillingSerializer() class Meta: model = Order fields = '__all__' def create(self, validated_data): billing_data = validated_data.pop('billing') order = Order.objects.create(**validated_data) Billing.objects.create(**billing_data) return order I can create nested data. but when I get a view it displays like this: { "id": 1, "billing": {}, "quantity": 3, "delivery_date": "2017-01-27T15:44:40Z", "base_rate": "90.00", "is_delivered": false, "created_at": "2017-01-26T07:26:53.194450Z", "updated_at": "2017-01-26T07:26:53.194495Z", "user_id": 1 } Empty dict for billing. My models are as follows: class Billing(models.Model): paid_status = models.BooleanField(default=False) total_billed = models.DecimalField(default=90.00, max_digits=6, decimal_places=2) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Meta: ordering = ('created_at',) verbose_name = 'Billing' verbose_name_plural = 'Billings' class Order(models.Model): user_id = models.ForeignKey('auth.User', related_name='orders', on_delete=models.CASCADE) quantity = models.PositiveIntegerField(validators=[MaxValueValidator(10)]) delivery_date = models.DateTimeField(default=datetime.now()+timedelta(days=1)) base_rate = models.DecimalField(default=90.00, max_digits=6, decimal_places=2) is_delivered = models.BooleanField(default=False) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) billing = models.TextField() class Meta: ordering = ('created_at',) verbose_name = 'Order' verbose_name_plural = 'Orders' def __str__(self): return self.id Here is my oderView: class OrderViewSet(viewsets.ModelViewSet): queryset = Order.objects.all() serializer_class = OrderSerializer permission_classes = (permissions.IsAuthenticated, permissions.IsAdminUser,) How can I get my expected data? -
Updating Mysql JSON field in django
I'm using django 1.8.9 and MySQL 5.7.17. I've a following table: +----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+----------------+ | brand | varchar(255) | YES | MUL | NULL | | | new_info | json | YES | | NULL | | | keywords | json | YES | | NULL | | | notes | varchar(255) | YES | | NULL | | | id | mediumint(9) | NO | MUL | NULL | auto_increment | +----------+--------------+------+-----+---------+----------------+ In django I have this model: class info_by_kw(Model): brand = ForeignKey(Brand, on_delete=CASCADE, db_column='brand') # new_info = JSONField(blank=True, null=True) keywords = JSONField(blank=True, null=True) notes = CharField(max_length=255, blank=True, null=True) When the data is saved I get a very meaningful error: (-1, 'error totally whack'). Anyway, it ends up in the following SQL statement: UPDATE `products_info_by_kw` SET `brand` = _binary'BINGO!', `keywords` = _binary'[[\\"Tomato\\", \\"Madness\\"]]', `notes` = _binary'' WHERE `products_info_by_kw`.`id` = 48; With the more or less expected result: ERROR 3144 (22032): Cannot create a JSON value from a string with CHARACTER SET 'binary'. Brief search gave this result: https://code.djangoproject.com/ticket/26140, so maybe it's a right thing to do and my mysql (or django) is misconfigured. Does anyone have an … -
sending html in django http response
I'm new to webdevelopment. i'm trying to send a html string as a response and my server is hosted by ptyhtonanywhere. This is my urls.py urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^plot/',response),] This is my views function def response(request): html = '<!DOCTYPE html><html><head></head><body>blah/body></html>' return HttpResponse(html) when access the /plot/ url it says 'If this is your PythonAnywhere-hosted site, then you're almost there — you just need to create a web app to handle this domain.' But i'm just trying to send a html response to the browser. Isn't it supposed to display the html content. what am I missing? -
Django jinga2 syntax confusing
{% extends "personal/home.html"%} { % block content%} (% include 'personal/includes/help.html' %) (% endblock %) The line 4 correct syntax would be {% endblock %} however I get "forgot to register tag?" TemplateSyntaxError edit : I solved the issue using (% endblock %) instead of curls. Any idea why this is happening? -
How to run a 30 minute API call in django
In my django app, I have a function that triggers an action (a republishing action) and checks its status for 30 minutes via an API call. timeout = time.time() + 60 * 30 published_flag = False while time.time() < timeout: data = requests.get(apiUrl + dist_id).json() try: published_flag = data['flags'] if published_flag: break else: time.sleep(5) continue except KeyError: break This timeout is 30 minutes and is very long. But 30 minutes is the worst case scenario when the flag status would change. This action can be triggered multiple times (multiple republish buttons can be pressed). The endpoint essentially times out as 30 minutes is too long for an endpoint to work. So I push the data via web sockets to the frontend. Is there a smarter way to do this? -
Django BigAuto User (how to get a 64 bit PK for the User table)
DJango 10 finally allow the BigAuto field to map to PostgreSQL's "bigserial" type --- which is fine, but the User table included by default still uses a regular 32 bit auto field as it's PK. Now... don't get me wrong... I don't plan right now to have more than 32 bits of users, but I hate choosing a field that really might be too small. And in my current case, it's reasonable to think that I will at some point have > 32 bit of users. Anyways, regardless of motivation, how do I get a 64 bit PK on the User table so that I can still take advantage of django's built-in stuff? -
Is it possible to convert datetime fields from UTC to client's local time with django rest framework
This is my article model: class Article(models.Model): url = models.CharField(max_length=256) headline = models.CharField(max_length=256) source = models.ForeignKey(Source) datetime_ingested = models.DateTimeField(auto_now_add=True) content = models.TextField() image_src = models.CharField(max_length=256, null=True) And this is my serializer: class ArticleSerializer(serializers.ModelSerializer): class Meta: model = Article fields = ('id', 'url', 'headline', 'source', 'datetime_ingested', 'content', 'image_src') All date time fields are in UTC, and I want to convert the time to the client's localtime. Is this possible to do from the framework's side? Right now I'm serving the content, parsing the date using moment.js (https://momentjs.com/) to display contextual datetime based on the current timezone like so: moment(article['datetime_ingested'], "YYYY-MM-DD hh:mm:ss").fromNow() But this translates UTC to now. Is it possible to tell Django to serve the datetime fields in the client's timezone? -
Opening bootstrap modal view in Django for editing a post
I am learning basic Django development and am creating a simple blog app with several posts that I create. My home page includes this code that iterates through all posts and displays them. {% for post in all_posts %} <div class="post-card"> {{post.title}} {{post.description}} <a data-toggle="modal" data-target="#postEditModal"> Edit Post </a> </div> {% endfor %} I have a #postEditModal which links to the Bootstrap data-target method and shows the following <div id=#postEditModal class="modal fade" style="overflow: scroll;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> {{editpostform}} </div> My goal is to be able to click on the "Edit Post" link for each individual post, which should redirect to the slug for the post and open the modal all on top of the same page, and from there I should be able to edit the post using my {{editpostform}}. Clicking outside of the modal area should revert back to the same page. I have tried many things like post.get_absolute_url and {% url single_post' post.id %}, but nothing so far has worked properly. I am assuming there is some level of Javascript/AJAX involved but I am not sure where to start with that. -
Django can not sent email with attachments
I am trying to sent email by using this code. But when I was trying. Either html or email attachment in sent. But not both. If I omit attachment email body is sent. but if I add attachment email body is not sent . Please someone provide you suggestion. msg = EmailMultiAlternatives(subject=self.mail_subject, from_email=from_mail, to=(to,), connection=connection) if isinstance(attachment, list): for attach_path in attachment: msg.attach_file(attach_path) msg.attach_alternative(html_with_context_data, "text/html") try: msg.send(fail_silently=True) except: pass -
When creating a custom User model in Django what is the difference between inheriting from models.Model and AuthUser?
I've seen two ways of extending the User model in Django. Method 1: class User(AuthUser): new fields... Method 2: class MyUser(models.Model): user = models.OneToOneField(User) new fields... What is the difference between them? -
Bootstrap custom theme only loads sometimes
I've been having this problem for a while, I'm trying to make a website with Django, and I've started using bootstrap. The problem is that my custom CSS only loads sometimes. Meaning when I make a change to the code, the changes won't always be reflected on the page. Then I'll leave my computer, come back a few hours later and the changes will be there. Here's my code: {% load staticfiles %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>DUFC Sign-In</title> <!-- Bootstrap --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <!--<link rel="stylesheet" href="{% static 'css/bootstrap-theme.css' %}">--> <link rel="stylesheet" href="{% static 'css/bootstrap-override.css' %}"> <script src="{% static 'js/bootstrap.min.js' %}"></script> </head> <nav class="navbar navbar-default" role="navigation"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">DUFC</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse navbar-ex1-collapse"> <ul class="nav navbar-nav"> <li class="active"><a href="{% url 'sign_in' %}">click</a></li> … -
How to get Django and ReactJS to work together?
New to Django and even newer to ReactJS. I have been looking into AngularJS and ReactJS, but decided on ReactJS. It seemed like it was edging out AngularJS as far as popularity despite AngularJS having more of a market share, and ReactJS is said to be quicker to pickup. All that junk aside, I started taking a course on Udemy and after a few videos it seemed important to see how well it integrates with Django. That is when I inevitably hit a wall just getting it up and running, what kind of documentation is out there so that I am not spinning my wheels for several hours and nights. There really isn't any comprehensive tutorials, or pip packages, I came across. The few I came across didn't work or were dated, pyreact for example. One thought I had was just to treat ReactJS completely separate, but keeping into consideration the classes and IDs I want the ReactJS components to render in. After the separate ReactJS components are compiled into a single ES5 file, just import that single file into the Django template. I think that will quickly breakdown when I get to rendering from Django models although the Django … -
Multi-DB Transactions
Django Version 1.10.5 with Postgres 9.6.1 For the last year I've been working in a multi-schema default database environment. However things are beginning to grow to the point I've decided to split the single database into 3 databases. I've got things working with a master/slave router for all 3 databases. I am not using the 'default' database key. Instead I have 'db1', 'db2', and 'db3' The part I am confused about is with transactions in this multi-database environment. In this example it fails as expected. Caused of course by not using @transaction.atomic(using='db1') which is clear to me. @transaction.atomic() def edit(self, context): """Edit :param dict context: Context :return: None """ # Check if employee exists try: result = Passport.objects.get(pk=self.user.employee_id) except Passport.DoesNotExist: return False result.name = context.get('name') result.save() However I have this strange example, simply because I'm trying to understand... I would have expected this to fail but it does not: @transaction.atomic(using='db1') def edit(self, context): """Edit :param dict context: Context :return: None """ # Check if employee exists try: result = Passport.objects.get(pk=self.user.employee_id) except Passport.DoesNotExist: return False result.name = context.get('name') with transaction.atomic(using='db2'): result.save() The model Passport does not exist in DB2 models at all. My router is setup so that all writes go … -
Django: Adding Model instances from REST data
I'm a bit new to Django so I'm not sure the proper way to do this. I want to create an instance of my model based on cleaned JSON data from another api. In my normal python script, I had everything in the same file, but I want to organize it a bit better for Django. Would I simply have the model in the models.py, and use a view to make the GET request to the API and have that view call another function that cleans and adds the JSON data as a model instance? Is there a standard way of doing this? -
Django working with Angular.js static file
I am using Angular as my front end and Django as back end. What I am facing is my server load the static file really slowly.Although,when I ran the server,the html shows the static file exist, but when I click on the url, it just keep load the file and eventually crashed.This is the GitHub link:https://github.com/Honesty1997/my-lotto-game.git Hope you can help me find the problem!I am sure the django static file settings are all right! -
Django ValueError: 'dtedeclared with a lazy reference to .....' when changed Model Name
This is the first models that I created class IPAddresses(models.Model): ''' @brief Class for ip addresses. @attrs name Can be company name ''' ip = models.GenericIPAddressField() name = models.CharField(max_length=150, null=True, blank=True) active = models.BooleanField(default=True) def __unicode__(self): return self.ip class Authentication(models.Model): ''' @brief Custom Authentication for dashboard @attrs name can be a name of a person ''' name = models.CharField(max_length=100, null=True, blank=True) password = models.CharField(max_length=200, unique=True) ip = models.ManyToManyField(IPAddresses, blank=True) However, I changed the model name of 'IPAddresses' to 'IPAddress' and run migrate. It was fine however my next migrates are not and kept receiving this Value Error: Apply all migrations: admin, auth, cache_admin, contenttypes, core, provider, saba_dashboard, sessions Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute output = self.handle(*args, **options) File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 164, in handle pre_migrate_apps = pre_migrate_state.apps File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/django/db/migrations/state.py", line 176, in apps return StateApps(self.real_apps, self.models) File "/Users/deanchristianarmada/Desktop/projects/asian_gaming/radar/lib/python2.7/site-packages/django/db/migrations/state.py", line 249, in __init__ raise ValueError("\n".join(error.msg for error in errors)) ValueError: The field saba_dashboard.Authentication.ip was declared with … -
Django SECRET_KEY unique for same project on each workstation?
Quick Django question. I know these are unique for every project and shouldn't be shared as it is part of the hashing algorithm, I think. However, if you are working on the same project on multiple workstation, the SECRET_KEY would be the same on all of them since it is the same project? Or unique to each workstation? If it is part of the hashing algorithm, I would think it would be by project. -
how to get submit a foreign key into a form post? python /django
actually I don't have a form, I am currently using the ViewSet to create API. I have two models, one is a regular user model and a group model which uses a field named creator with ForeignKey to the user I created a serializer then use it to validate the POST inputs, somehow I keep on getting the error saying null value in column "creator_id" violates not-null constraint Which I can understand and I tested too that it's because creator_id is null when I try to post, but I did enter the creator_id though. Am I entering it in a wrong way or how do I get the foreign key in order to save it? My group model is like this class Group(Model): creator = ForeignKey(User, null=True, // I used this to test I am right with the error blank=True, // I used this to test I am right with the error on_delete=CASCADE, related_name="%(class)ss", related_query_name="%(class)s") group_name = CharField(max_length=256, unique=True) created_at = DateTimeField(auto_now_add=True) def __unicode__(self): return self.group_name again, I added null=True, blank=True is because I want to see if I am right that it's because of creator_id can't be null and yes I am right, after adding these two fields, I … -
Getting values from django model for further use in view
I have a model with 3 fields (name, url, date). How can I get url in my view and put it inside method? sites = Site.objects.all().order_by('date')[:3] I need to get host from url (http://www.example.com to example.com). I have a class for this task: class SiteThumb(): def get_site_thumb(self, url): host = urlparse(url).hostname if host.startswith('www.'): host = host[4:] return(host) I would like to use it later in my template (something similar to {{ site.url }} but with use of variable 'host' related to particular 'site' object).I can not deal with it. I can with another view where is only one site: def site(request, category_slug, subcategory_slug, id): There is id which I can simply assign to particular object. In my base view def index(request): I have to load a couple of objects. Thanks for any clues. -
Django multi-level extends not appearing
With Django 1.10 I am building a blog/portfolio hybrid website. Besides Mysite, I have two apps, Blog and Portfolio. Within blog/templates/ I have an index.html that displays content from both Blog and Portfolio (the 15 most recent blog posts and 5 most recent portfolio projects). So the index.html page looks like this: http://imgur.com/y2UqBSS As you can see data is not appearing. However, it does when I navigate to the Blog page and Portfolio page. For example, the Blog page: http://imgur.com/7P922Ga I am figuring that this issue is related to the mult-level extends that I have going on. Because the Blog and Portfolio pages both display content from the database, it makes me think that the models are O.K but something is up with the views. The index.html extends the base_generic.html template, and my recent_blog_posts.html and recent_portfolio_pieces.html extends the index.html. I am not sure how to remedy this issue. Any suggestions what I'm doing wrong? Project structure mysite/ ---blog/ ------static/ ---------css/ ---------images/ ------------blogpostimages/ ------------favicon.ico ------templates/ ---------blog/ ------------blog_post.html ------------blog_list.html ------------recent_blog_posts.html ---------base_generic.html ---------index.html ---------bio.html ---------resume.html ------admin.py ------apps.py ------models.py ------tests.py ------urls.py ------views.py ---portfolio/ ------static/ ---------css/ ---------images/ ------------portfoliopieceimages/ ------templates/ ---------portfolio/ ------------portfolio_piece.html ------------portfolio_list.html ------------recent_portfolio_pieces.html ------admin.py ------apps.py ------models.py ------tests.py ------urls.py ------views.py ---mysite/ ------settings.py ------urls.py ------wsgi.py manage.py db.sqlite3 …