Django

Make a Blog using Django Part 2

From previous post, you have configured and ran django, also added admin site to the django. To view the working source of this tutorial, check here at: https://github.com/ruddra/myblog Now click on the myblog section and click add to add new blog. You can create new tags using Tags section of the admin page or clicking the (+) button right beside the Tags section on the new blog creation page, marked with blue circle in the previous image. After successfully adding a new blog, you can see it…

Keep reading

Make a Blog using Django Part 1

"Making a blog using django" is probably the most made tutorial of Django. This post is no different. But I made this in my own way using some of django's built-in features so that less coding is required and making it more understandable with minimum packages to use. To view the working source of this tutorial, check here at: https://github.com/ruddra/myblog Before jumping to the main event, see if you have these installed in your pc: 1. Python 3 installed in the computer. (Or python 2.7…

Keep reading

Change Column Header Dynamically in Django Tables2

Django Tables2 is a package which displays table directly from queryset. It shows column header based on object's attribute's name. But if someone wants to override it, how can he/she do that? Here is a easy solution. Suppose we have a model class like this: class SomeModel(models.Model): somevalue = models.CharField() And we want to show table column somevalue to overridenvalue Table Class: class SomeTable(tables.Table): def __init__(self, *args, _overriden_value="",**kwargs): super().__init__(*args, **kwargs) self.base_columns['somevalue'].verbose_name = _overriden_value class Meta:…

Keep reading

How to configure Django/Tornado in PyCharm Community Edition

I think, Pycharm is THE best IDE for developing python. But unfortunately, the professional edition is not free. But community edition is good enough for doing debugging, integrating GIT etc. Normally its easy to use the community edition for django and tornado's debugging/running if you know how to configure. Django For django's configuration, there is 5 easy steps: First: Go to edit configuration and click on it(like the below pictures). Second: Click on the (+) mark in top-left corner and add python configuration. Third: Click on the Script, and…

Keep reading

Some Useful Tools/Function for Django

I am going to share some useful Django tools/functions which are very useful(were for me atleast) to get things done. Return any model class and its properties This method will return any model class if you have the name of the class. from django.db import models def get_model_description(model_name=None, return_property_list=True): for item in models.get_models(include_auto_created=True): if item.__name__ == model_name: if return_property_list is True: return item.get_trigger_properties() else: return item return…

Keep reading