Django Social Blog

February 14, 2019

Cover Image
CodaBool

CodaBool

Django Social Media application, my second Django project.

This project was still while under the same Udemy course. The teacher did a great job of explaining every piece and how it fit into a larger whole. Like the previous Django project I did, a blog application, I still was new to the framework. The course led us to deploy on a hosting service called PythonAnywhere. I did follow the course but after completion I learned Heroku and changed my deployment to there. Both projects can be viewed now under the projects tab. The code is also visible by visiting my Github page.

This is a social media clone of Twitter. The features are mainly composed of accounts, groups and posts. An account is created on a signup page. The account can then be logged in or out. Groups can be created, joined or deleted. Posts can be either created or deleted. All groups and posts can be viewed in a list. The project makes use of SQLite, Bootstrap, Misaka and django-braces.

image
class JoinGroup(LoginRequiredMixin, generic.RedirectView):

    def get_redirect_url(self, *args, **kwargs):
        return reverse("groups:single",kwargs={"slug": self.kwargs.get("slug")})

    def get(self, request, *args, **kwargs):
        group = get_object_or_404(Group,slug=self.kwargs.get("slug"))

        try:
            GroupMember.objects.create(user=self.request.user,group=group)

        except IntegrityError:
            messages.warning(self.request,("Warning, already a member of {}".format(group.name)))

        else:
            messages.success(self.request,"You are now a member of the {} group.".format(group.name))

        return super().get(request, *args, **kwargs)

I already covered my experiences with Django and Python in my post about Django blog project. I enjoy the framework and language. I see myself using React and JavaScript in the future but I am in love with Python as a way of scripting and doing object oriented programming.

Thanks for reading 👍