Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Comentário sobre Configurando um projeto Django no UOL Host – segunda parte por Image Hosting
I commonly don't write comments on posts, but your article urged me to commend your writings. Thanks for writing this, I will certainly well-known your site and come back once in awhile. Content blogging. -
Amsterdam based, VC funded startup, Fashiolista looking for new team members
Over the past months Fashiolista has grown to be one of the largest fashion communities worldwide. Dividing attention between scaling the site and creating new features has been quite a challenge. We are looking for a very experienced django developer to join our team. About Fashiolista Fashiolista is best described as “twitter for fashion”. Girls follow each other’s fashion finds and indicate which items they love. We are funded by Atomico ventures and several high profile angel investors. Why you will love working at Fashiolista - Young team, startup culture - Developers in the founding team - The team has been working with Django for more than 4 years - Modern stack (Django 1.3, postgres, redis, memcached, jquery, celery, solr, GIT) - Learning culture Did I mention we are located in the centre of Amsterdam? Who we are looking for We are looking for a talented Django developer with experience in building highly scalable applications. Since our team is small, strong experience with Linux or Freebsd system administration would be a big plus. Experienced with Django and Python (> 3 years preferably) Knowledge of SQL and query optimization Javascript experience Test driven development Memcached and other caching techniques GIT Bonus … -
Django timedelta custom model field (with full example)
This intends to show a full working example of a django custom model field. TimeDeltaField uses python object serialization or namely pickle, to store a datetime.timedelta type native python object on a database in the form of character data. This example implements only the must-have elements for it's working. import datetime import pickle from django.db import models class TimeDeltaField(models.Field): """Custom model field to store python native datetime.timedelta object in database, in serialized form. """ __metaclass__ = models.SubfieldBase def __init__(self, *args, **kwargs): # Set the max_length to something long enough to store the data # in string format. kwargs['max_length'] = 200 # Make sure the default specified is also serialized, else the # objects own string representation would be used. if 'default' in kwargs: kwargs['default'] = pickle.dumps(kwargs['default']) super(TimeDeltaField, self).__init__(*args, **kwargs) def get_internal_type(self): # Store the serialized data as the default 'CharField' type in # the database. return 'CharField' def to_python(self, value): if isinstance(value, basestring): # De-Serialize into timedelta. return pickle.loads(str(value)) return value def get_prep_value(self, value): # Serialize the object. return pickle.dumps(value) class MyModel(models.Model): """Dummy implementation of a model. """ timedelta = TimeDeltaField(default=datetime.timedelta(days=30)) def __unicode__(self): return unicode(self.id) This entitles us to use APIs such as: # Creates a models instance with default … -
Django timedelta custom model field (with full example)
This intends to show a full working example of a django custom model field. TimeDeltaField uses python object serialization or namely pickle, to store a datetime.timedelta type native python object on a database in the form of character data. This example implements only the must-have elements for it's working. import datetime import pickle from django.db import models class TimeDeltaField(models.Field): """Custom model field to store python native datetime.timedelta object in database, in serialized form. """ __metaclass__ = models.SubfieldBase def __init__(self, *args, **kwargs): # Set the max_length to something long enough to store the data # in string format. kwargs['max_length'] = 200 # Make sure the default specified is also serialized, else the # objects own string representation would be used. if 'default' in kwargs: kwargs['default'] = pickle.dumps(kwargs['default']) super(TimeDeltaField, self).__init__(*args, **kwargs) def get_internal_type(self): # Store the serialized data as the default 'CharField' type in # the database. return 'CharField' def to_python(self, value): if isinstance(value, basestring): # De-Serialize into timedelta. return pickle.loads(str(value)) return value def get_prep_value(self, value): # Serialize the object. return pickle.dumps(value) class MyModel(models.Model): """Dummy implementation of a model. """ timedelta = TimeDeltaField(default=datetime.timedelta(days=30)) def __unicode__(self): return unicode(self.id) This entitles us to use APIs such as: # Creates a models instance with default … -
django CMS 2.2 release candidate available
django CMS 2.2 release candidate available -
Django ve Url Düzeltme
Internet tarayıcısına elle url girenler, url'leri yanlış yazmalarından dolayı gördükleri 404 sayfalarını hatırlayacaktır. Bu 404 sayfaları sinir bozucudur. Özellikle de ziyaretçiye kolaylık sağlayan bir özellikleri yoksa. 404 sayfaları, ziyaretçiye site haritası sunarak, ya da ziyaretçiye bazı önerilerde bulunarak ziyaretçiye kolaylık sağlayabilir. Ancak, 404 sayfasını atlayıp, ziyaretçiyi gerçekten gitmek istediği sayfaya yönlendirmek en doğrusu olacaktır. Ziyaretçileriniz gerçekten nereye gitmek istediklerini anlamak için, bir yazım düzeltme algoritması'na ihtiyaç duyacaksınız. Ben, verdiğim bağlantıdaki algoritmanın, biraz basitleştirilmiş bir halini kullanacağım. alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789-' # http://norvig.com/spell-correct.html adresindeki algoritma değiştirilmiştir. def suggest(word,Nwords): splits = [(word[:i], word[i:]) for i in range(len(word) + 1)] deletes = [a + b[1:] for a, b in splits if b] transposes = [a + b[1] + b[0] + b[2:] for a, b in splits if len(b)>1] replaces = [a + c + b[1:] for a, b in splits for c in alphabet if b] inserts = [a + c + b for a, b in splits for c in alphabet] all_suggestions = set(deletes + transposes + replaces + inserts) return [suggestion for suggestion in all_suggestions if suggestion in Nwords] ilk satırda tanımladığımız, alphabet karakter dizisindeki her karakter, yanlış kelimedeki eksik karakteri doldurmak için veya yanlış karakterleri değiştirmek için kullanılacak. 3. satırda, tanımladığım … -
Django ve Url Düzeltme
Internet tarayıcısına elle url girenler, url'leri yanlış yazmalarından dolayı gördükleri 404 sayfalarını hatırlayacaktır. Bu 404 sayfaları sinir bozucudur. Özellikle de ziyaretçiye kolaylık sağlayan bir özellikleri yoksa. 404 sayfaları, ziyaretçiye site haritası sunarak, ya da ziyaretçiye bazı önerilerde bulunarak ziyaretçiye kolaylık sağlayabilir. Ancak, 404 sayfasını atlayıp, ziyaretçiyi gerçekten gitmek istediği sayfaya yönlendirmek en doğrusu olacaktır. Ziyaretçileriniz gerçekten nereye gitmek istediklerini anlamak için, bir yazım düzeltme algoritması'na ihtiyaç duyacaksınız. Ben, verdiğim bağlantıdaki algoritmanın, biraz basitleştirilmiş bir halini kullanacağım. alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789-' # http://norvig.com/spell-correct.html adresindeki algoritma değiştirilmiştir. def suggest(word,Nwords): splits = [(word[:i], word[i:]) for i in range(len(word) + 1)] deletes = [a + b[1:] for a, b in splits if b] transposes = [a + b[1] + b[0] + b[2:] for a, b in splits if len(b)>1] replaces = [a + c + b[1:] for a, b in splits for c in alphabet if b] inserts = [a + c + b for a, b in splits for c in alphabet] all_suggestions = set(deletes + transposes + replaces + inserts) return [suggestion for suggestion in all_suggestions if suggestion in Nwords] ilk satırda tanımladığımız, alphabet karakter dizisindeki her karakter, yanlış kelimedeki eksik karakteri doldurmak için veya yanlış karakterleri değiştirmek için kullanılacak. 3. satırda, tanımladığım … -
Django South göçünde "unique" alan hatası
Django veritabanlarında sık sık south ile veritabanı göçü yapanlardansanız bu hataya dikkat edin. Bu hata "unique" bir alana sahip bir tabloyu göç ederken, initial_data fikstürü varsa oluşuyor ve rahatsız edici bir hata veriyor.Bu hatanın oluşmasının nedeni, south'un göç aşamasında initial_data fikstürünü yüklemeye çalışmasından kaynaklanıyor. "unique" özelliğe sahip bir alandan birden fazla oluşturmaya çalışmasına neden olan bu hata, göç oluştururken değil, göç işlemi sırasında kendini belli ediyor. Bu sebeple, eğer south ile veritabanı göçü yapacaksanız, göç işlemi sırasında initial_data fikstürünü bir süreliğine south tarafından bulunamayacak bir yere taşımanızı tavsiye ederim. -
Django South göçünde "unique" alan hatası
Django veritabanlarında sık sık south ile veritabanı göçü yapanlardansanız bu hataya dikkat edin. Bu hata "unique" bir alana sahip bir tabloyu göç ederken, initial_data fikstürü varsa oluşuyor ve rahatsız edici bir hata veriyor.Bu hatanın oluşmasının nedeni, south'un göç aşamasında initial_data fikstürünü yüklemeye çalışmasından kaynaklanıyor. "unique" özelliğe sahip bir alandan birden fazla oluşturmaya çalışmasına neden olan bu hata, göç oluştururken değil, göç işlemi sırasında kendini belli ediyor. Bu sebeple, eğer south ile veritabanı göçü yapacaksanız, göç işlemi sırasında initial_data fikstürünü bir süreliğine south tarafından bulunamayacak bir yere taşımanızı tavsiye ederim. -
Lots Of Happenings
Yay! First post in nearly 4 months! I feel kinda bad for leaving my April Fools Day joke on the front page for such a long time, but lucky for me my blog isn't very popular! I could have found myself in a world of hurt. I'd like to give you all a quick update on what's been going on in my life that somewhat justifies a 4-month window of no blog posts. First of all, we had 25% of our backend development team (1 person, leaving 3 developers) get fired earlier in the year, so the workload at my day job got to be a bit heavier. Second, my wife and I were pregnant with identical twin girls. It was a relatively high-risk pregnancy, so we spent many days in the hospital for checkups and whatnot. The doctors gave her somewhat strict bed rest orders, and I worked from home since the beginning of July (my job is awesome that way) so I could keep and eye on my wife and help with our soon-to-be two year old son. Third, we had our identical twin girls this past Tuesday. They arrived at 9:25 and 9:27, and their names are … -
Django Facebook 3.0 – OAuth migration – Time to upgrade!
Facebook is migrating to HTTPS and OAuth to increase the safety of their users. Unfortunately these changes aren’t backwards compatible and will require some effort to follow. To support the new Facebook system you need to upgrade to Django Facebook 3.0 before October 1st. In addition to the required migrations, this version also includes several new features. The largest change is the underlying Facebook API client. You can read about the improvements here or skip down to the upgrade instructions. Open Facebook – New Python Facebook client Open Facebook is a python client to the Facebook graph API. Currently it’s included in Django Facebook, but in time it will be spun of as a separate project. The client is supported, tested and up to date with the current version of Facebook’s graph API. It handles connection issues cleanly and raises separate error classes for various Facebook error scenarios. The syntax is very straightforward to use: open_facebook = OpenFacebook(token) #info about me open_facebook.me() #retrieving a page open_facebook.get('fashiolista') #retrieving your albums open_facebook.get('me/albums') #posting a message on your wall open_facebook.set('me/feed', message='Check out Fashiolista', picture=image_url) #setting a like open_facebook.set('fashiolista/likes') #fql example result = open_facebook.fql('SELECT name FROM user WHERE uid = me()') #authorization is handled … -
New: Configurable Applications
You want to allow configuration of your app without having to modify its code. You may also want to provide reasonable defaults that users can override. -
5 Django İpucu
Başlangıç seviyesindeki anlatımlarda çok sık karşılaşamayacağınız, ancak, Django ile uygulama geliştirirken işinize yarayacak 5 ipucunu sizlerle paylaşmak istedim.Veritabanına Başlangıç Verisi Yüklemek Geliştirme aşamasında sık sık veritabanını baştan başlatıyorsanız, veya uygulamanızın çalışması için, kurulumdan sonra bazı verilerin veritabanına yazılması gerekiyorsa, bu ipucu sizin için. Uygulamanızın içinde açacağınız "fixtures" dizininin içerisinde, initial_data.[xml, json veya yaml] isimli belgede, syncdb komutuyla birlikte veritabanına yazılacak verileri belirleyebilirsiniz. Eğer uygulamanızda south kullanıyorsanız, south'da inital_data ile ilgili hata'ya göz atmanızda fayda var. initial_data.json örneği aşağıda. [ { "model": "blog.Setting", "pk": 1, "fields": { "anahtar": "blog_baslik", "deger": "Blog Title Goes Here!" } }, { "model": "blog.Setting", "pk": 2, "fields": { "anahtar": "blog_slogan", "deger": "Slogan Goes Here!" } } ] Admin panelinde, sadece okunabilen alanlar Eğer modelinizdeki bazı alanların admin panelinde görünmesini istiyor, ancak, o alanların düzenlenebilir olmasını istemiyorsanız, bunu readonly_fields ile belirtebilirsiniz. class PostAdmin(admin.ModelAdmin): readonly_fields = ("slug","last_mod","pub_date") admin.site.register(Post,PostAdmin) Admin panelinde göstermeden alan doldurmak Modelinize ait bazı alanları, admin panelinde göstermeden, programatik olarak doldurabilirsiniz. Admin paneli, modelleri kaydetmek için, ModelAdmin sınıfının, save_model sınıfını kullanıyor. Bu metodun üstüne yazabilirsiniz. class PostAdmin(admin.ModelAdmin): # excludes içindeki alanlar admin panelinde görünmezler. excludes = ("author",) def save_model(self,request,obj,form,change): # change False ise, ilk kez oluşturuluyordur. if not change: obj.author = request.user obj.save() Gzip sıkıştırması Görünümlerinize … -
5 Django İpucu
Başlangıç seviyesindeki anlatımlarda çok sık karşılaşamayacağınız, ancak, Django ile uygulama geliştirirken işinize yarayacak 5 ipucunu sizlerle paylaşmak istedim.Veritabanına Başlangıç Verisi Yüklemek Geliştirme aşamasında sık sık veritabanını baştan başlatıyorsanız, veya uygulamanızın çalışması için, kurulumdan sonra bazı verilerin veritabanına yazılması gerekiyorsa, bu ipucu sizin için. Uygulamanızın içinde açacağınız "fixtures" dizininin içerisinde, initial_data.[xml, json veya yaml] isimli belgede, syncdb komutuyla birlikte veritabanına yazılacak verileri belirleyebilirsiniz. Eğer uygulamanızda south kullanıyorsanız, south'da inital_data ile ilgili hata'ya göz atmanızda fayda var. initial_data.json örneği aşağıda. [ { "model": "blog.Setting", "pk": 1, "fields": { "anahtar": "blog_baslik", "deger": "Blog Title Goes Here!" } }, { "model": "blog.Setting", "pk": 2, "fields": { "anahtar": "blog_slogan", "deger": "Slogan Goes Here!" } } ] Admin panelinde, sadece okunabilen alanlar Eğer modelinizdeki bazı alanların admin panelinde görünmesini istiyor, ancak, o alanların düzenlenebilir olmasını istemiyorsanız, bunu readonly_fields ile belirtebilirsiniz. class PostAdmin(admin.ModelAdmin): readonly_fields = ("slug","last_mod","pub_date") admin.site.register(Post,PostAdmin) Admin panelinde göstermeden alan doldurmak Modelinize ait bazı alanları, admin panelinde göstermeden, programatik olarak doldurabilirsiniz. Admin paneli, modelleri kaydetmek için, ModelAdmin sınıfının, save_model sınıfını kullanıyor. Bu metodun üstüne yazabilirsiniz. class PostAdmin(admin.ModelAdmin): # excludes içindeki alanlar admin panelinde görünmezler. excludes = ("author",) def save_model(self,request,obj,form,change): # change False ise, ilk kez oluşturuluyordur. if not change: obj.author = request.user obj.save() Gzip sıkıştırması Görünümlerinize … -
New: Configurable Applications
New: Configurable Applications -
Django sunucusu olarak dotcloud
Son zamanlarda bilişim çevrelerinde sık sık duyabileceğiniz "cloud computing" teriminin henüz oturmuş bir sözlük anlamı yok. En sık kullanılan anlamında "cloud computing" bir bilgisayarın kaynaklarının çoğunlukla sanallaştırma yazılımlarıyla birlikte, birden fazla kişi tarafından bölüşülmesi demek. Bu hizmeti sağlayan "dotcloud" firmasının, django uygulamalarını destekleyen bir altyapısı var ve belirli sınırlamalar çerçevesinde bu hizmeti ücretsiz alabiliyorsunuz.Dotcloud'u kullanarak, sağladığı hizmetlerden bir veya birkaçı'nı seçerek, Dotcloud sunucularında bir sanal makina oluşturabiliyoruz. Sağladığı hizmetlerin çerçevesi mysql, postgresql gibi sık kullanılan veritabanı sistemlerini, Python gibi programlama dillerini içine alıyor. Bu yazıyı yazdığım tarihte, 13 adet servis kullanılabiliyordu. Bu servisler ile codeigniter, django, phpbb, wordpress,mediawiki gibi yazılımların çalıştırabilmesi mümkün görünüyor. Dotcloud galerisinde de Dotcloud ile sunulan birkaç örnek sitenin linklerine ve bu sitelerin hangi hizmetlere birlikte sunulduğu bilgisine ulaşabilirsiniz. Dotcloud'un ücretlendirme politikası, sanal makine başına kullandığınız servis sayısı, kendinize özgü bir domain adı isteyip istemediğiniz gibi birkaç değişkene bağlı olarak değişiyor. Örneğin, bu blog'un sunumunu Dotcloud ile ücretsiz olarak yapıyorum. Saniyede 1000'den fazla istemin yapıldığı çok büyük bir kullanıcı kitlesine sahip, ya da ona benzer bir siteniz yoksa, Dotcloud'un ücretsiz sağladığı hizmetin bir django projesi sunmak için yeterli olacağını düşünüyorum. Dotcloud'u kullanabilmek için yapmanız gereken ilk iş, tahmin edebileceğiniz gibi, Dotcloud web sayfasını ziyaret edip, üye kaydı … -
Django sunucusu olarak dotcloud
Son zamanlarda bilişim çevrelerinde sık sık duyabileceğiniz "cloud computing" teriminin henüz oturmuş bir sözlük anlamı yok. En sık kullanılan anlamında "cloud computing" bir bilgisayarın kaynaklarının çoğunlukla sanallaştırma yazılımlarıyla birlikte, birden fazla kişi tarafından bölüşülmesi demek. Bu hizmeti sağlayan "dotcloud" firmasının, django uygulamalarını destekleyen bir altyapısı var ve belirli sınırlamalar çerçevesinde bu hizmeti ücretsiz alabiliyorsunuz.Dotcloud'u kullanarak, sağladığı hizmetlerden bir veya birkaçı'nı seçerek, Dotcloud sunucularında bir sanal makina oluşturabiliyoruz. Sağladığı hizmetlerin çerçevesi mysql, postgresql gibi sık kullanılan veritabanı sistemlerini, Python gibi programlama dillerini içine alıyor. Bu yazıyı yazdığım tarihte, 13 adet servis kullanılabiliyordu. Bu servisler ile codeigniter, django, phpbb, wordpress,mediawiki gibi yazılımların çalıştırabilmesi mümkün görünüyor. Dotcloud galerisinde de Dotcloud ile sunulan birkaç örnek sitenin linklerine ve bu sitelerin hangi hizmetlere birlikte sunulduğu bilgisine ulaşabilirsiniz. Dotcloud'un ücretlendirme politikası, sanal makine başına kullandığınız servis sayısı, kendinize özgü bir domain adı isteyip istemediğiniz gibi birkaç değişkene bağlı olarak değişiyor. Örneğin, bu blog'un sunumunu Dotcloud ile ücretsiz olarak yapıyorum. Saniyede 1000'den fazla istemin yapıldığı çok büyük bir kullanıcı kitlesine sahip, ya da ona benzer bir siteniz yoksa, Dotcloud'un ücretsiz sağladığı hizmetin bir django projesi sunmak için yeterli olacağını düşünüyorum. Dotcloud'u kullanabilmek için yapmanız gereken ilk iş, tahmin edebileceğiniz gibi, Dotcloud web sayfasını ziyaret edip, üye kaydı … -
Django ile Blog Geliştirme - Rss ve Site Haritası
Site haritaları ve rss beslemeleri bir blogun olmazsa olmazlarındandır. Django'da bunların ikisini de yapmak çok kolay. sitemap ve rss beslemesi yapmak için gerekli sınıflar, django'nun içindeki contrib paketiyle bize sunuluyor.Bu yazı dizisinde bahsedilen blog uygulamasının son haline github deposundan ulaşabilirsiniz. Bu makale kullandığım örneklerde, halen bu gördüğünüz site için kullandığım kodları kullanacağım. Bu siteyi yazmaya başladığımda birkaç nedenden dolayı ingilizce olarak yazmaya başladığım için, değişken isimleri şimdiye kadar yaptığımız örneklerden farklı olacak. Ancak, gerekli açıklamaları yapacağımdan dolayı, bu örnekleri kendi projenize kolaylıkla uygulayabileceğinizi düşünüyorum. Atladığım bir nokta varsa, aşağıda gördüğünüz yorumlardan beni uyarırsanız sevinirim. Şimdi rss ile ilgili olan kodları görelim: # -*- coding:utf-8 -*- from django.contrib.syndication.views import Feed from django.shortcuts import get_object_or_404 from portal.blog.models import Post, Tag class LatestPosts(Feed): title = "yasar11732: En Son Yazılar" link = "/" description = "Yeni yazilarin güncellemeleri" def items(self): return Post.objects.filter(yayinlandi=True).order_by("-pub_date")[:5] def item_title(self,item): return item.title def item_description(self,item): return item.abstract def item_pubdate(self,item): return item.pub_date class TagFeed(Feed): def get_object(self,request,tag): return get_object_or_404(Tag, text=tag) def title(self,obj): return "yasar11732: %s ile ilgili makaleler" % obj.text def item_description(self,obj): return obj.abstract def link(self,obj): return "/tag/%s/" % obj.text def description(self, obj): return "%s ile ilgili tum yazilar" % obj.text def items(self,obj): return obj.post_set.filter(yayinlandi=True).order_by("-pub_date")[:15] def item_pubdate(self,item): return item.pub_date Bu modül, uygulamızın içerisinde … -
Django ile Blog Geliştirme - Rss ve Site Haritası
Site haritaları ve rss beslemeleri bir blogun olmazsa olmazlarındandır. Django'da bunların ikisini de yapmak çok kolay. sitemap ve rss beslemesi yapmak için gerekli sınıflar, django'nun içindeki contrib paketiyle bize sunuluyor.Bu yazı dizisinde bahsedilen blog uygulamasının son haline github deposundan ulaşabilirsiniz. Bu makale kullandığım örneklerde, halen bu gördüğünüz site için kullandığım kodları kullanacağım. Bu siteyi yazmaya başladığımda birkaç nedenden dolayı ingilizce olarak yazmaya başladığım için, değişken isimleri şimdiye kadar yaptığımız örneklerden farklı olacak. Ancak, gerekli açıklamaları yapacağımdan dolayı, bu örnekleri kendi projenize kolaylıkla uygulayabileceğinizi düşünüyorum. Atladığım bir nokta varsa, aşağıda gördüğünüz yorumlardan beni uyarırsanız sevinirim. Şimdi rss ile ilgili olan kodları görelim: # -*- coding:utf-8 -*- from django.contrib.syndication.views import Feed from django.shortcuts import get_object_or_404 from portal.blog.models import Post, Tag class LatestPosts(Feed): title = "yasar11732: En Son Yazılar" link = "/" description = "Yeni yazilarin güncellemeleri" def items(self): return Post.objects.filter(yayinlandi=True).order_by("-pub_date")[:5] def item_title(self,item): return item.title def item_description(self,item): return item.abstract def item_pubdate(self,item): return item.pub_date class TagFeed(Feed): def get_object(self,request,tag): return get_object_or_404(Tag, text=tag) def title(self,obj): return "yasar11732: %s ile ilgili makaleler" % obj.text def item_description(self,obj): return obj.abstract def link(self,obj): return "/tag/%s/" % obj.text def description(self, obj): return "%s ile ilgili tum yazilar" % obj.text def items(self,obj): return obj.post_set.filter(yayinlandi=True).order_by("-pub_date")[:15] def item_pubdate(self,item): return item.pub_date Bu modül, uygulamızın içerisinde … -
Per User Class Based Views
One of the features to come with Django 1.3 was official support for Class Based Views. Since it's released I've been starting to use Class Based Views more and more. Now i'm at a point where nearly all of the views I write are Class Based. One of the things that I love about Class Based Views is that you can easily extend them to modify functionality. A common thing to do with a view is to limit access to logged in users, and to only allow a user to view their own objects. Luckily Class Based Views make restricting a user to only seeing their objects pretty simple. Read More -
Beware of Python optimization
Public Service Announcement! The "Python optimization", as in "-O" flag or "WSGIPythonOptimize" option not only doesn't do what you expect, but can ruin your program. -
New: Version Reporting
New: Version Reporting -
Junior Django Developer Wanted
Caktus is currently seeking a junior Django developer for our team. The ideal candidate would have 6 months of experience of building dynamic web applications in any language, at least 3 months of experience using Python and Django, and also have a basic understanding of relational databases such as PostgreSQL and MySQL. The junior developer ... -
Django ile Blog Geliştirme - Şablonlar
Blog uygulamamızı bıraktığımızda uygulamamız tarayıcıya basit yanıtlar gönderebiliyordu. Bu yazımızda, Django'nun şablon sistemini kullanarak, uygulamalarımızı son kullanıcıya daha zarif bir şekilde sunmanın yollarından bahsedeceğiz.Bu yazı dizisinde bahsedilen blog uygulamasının son haline github deposundan ulaşabilirsiniz. Django'da şablon oluşturma işlemi, içeriğinin belirli kısımları Django tarafından doldurulacak şekilde bir belge oluşturmaktan ibarettir. Çoğu zaman bu sistem HTML sayfaları üretmek için kullanılsa da, Django'nun şablon sistemiyle javascript, css, xml belgeri gibi her türlü belgeyi betimleyip tarayıcıya gönderebilirsiniz. Hazırladığımız şablonların Django tarafından bulunabilmesi için, settings modülü içerisindeki TEMPLATE_LOADERS listesinde bulunan şablon bulucu python sınıfları kullanılır. Yeni başlanan bir proje yapılandırmasında, iki adet şablon bulucu sınıf aktif olarak gelir. Bunlardan birtanesi django.template.loaders.filesystem.Loader'dir. Django'nun şablon sisteminin bir parçası olan bu sınıf, şablonlarınızın yerini belirlemek için, yine settings modülü içerisinde belirttiğiniz TEMPLATE_DIRS listesindeki dosya yollarında şablonlarınızı bulmaya çalışır. Django'yla birlikte gelen ve öntanımlı olarak ayarların içerisinde belirtilen diğer bir şablon bulucu ise django.template.loaders.app_directories.Loader'dir. Bu sınıfın görevi ise, INSTALLED_APPS listesinde belirttiğiniz uygulamaların içerisindeki templates ismindeki dizinlerden aradığınız şablonları bulmaktır. Django'da geliştirdiğiniz uygulamaların yeniden kullanılabilir olması adına, uygulamaların kendi şablonlarını kendi içlerinde barındırması gerekir. Böylece, başka bir proje içine kopyalandıklarında, yeni projede yeniden şablon geliştirilmek zorunda kalınmaz. Bunu yapmak için, geliştirdiğimiz proje içerisinde, templates adında bir dizin oluşturup, içerisinde blog_anasayfa.html … -
Django ile Blog Geliştirme - Şablonlar
Blog uygulamamızı bıraktığımızda uygulamamız tarayıcıya basit yanıtlar gönderebiliyordu. Bu yazımızda, Django'nun şablon sistemini kullanarak, uygulamalarımızı son kullanıcıya daha zarif bir şekilde sunmanın yollarından bahsedeceğiz.Bu yazı dizisinde bahsedilen blog uygulamasının son haline github deposundan ulaşabilirsiniz. Django'da şablon oluşturma işlemi, içeriğinin belirli kısımları Django tarafından doldurulacak şekilde bir belge oluşturmaktan ibarettir. Çoğu zaman bu sistem HTML sayfaları üretmek için kullanılsa da, Django'nun şablon sistemiyle javascript, css, xml belgeri gibi her türlü belgeyi betimleyip tarayıcıya gönderebilirsiniz. Hazırladığımız şablonların Django tarafından bulunabilmesi için, settings modülü içerisindeki TEMPLATE_LOADERS listesinde bulunan şablon bulucu python sınıfları kullanılır. Yeni başlanan bir proje yapılandırmasında, iki adet şablon bulucu sınıf aktif olarak gelir. Bunlardan birtanesi django.template.loaders.filesystem.Loader'dir. Django'nun şablon sisteminin bir parçası olan bu sınıf, şablonlarınızın yerini belirlemek için, yine settings modülü içerisinde belirttiğiniz TEMPLATE_DIRS listesindeki dosya yollarında şablonlarınızı bulmaya çalışır. Django'yla birlikte gelen ve öntanımlı olarak ayarların içerisinde belirtilen diğer bir şablon bulucu ise django.template.loaders.app_directories.Loader'dir. Bu sınıfın görevi ise, INSTALLED_APPS listesinde belirttiğiniz uygulamaların içerisindeki templates ismindeki dizinlerden aradığınız şablonları bulmaktır. Django'da geliştirdiğiniz uygulamaların yeniden kullanılabilir olması adına, uygulamaların kendi şablonlarını kendi içlerinde barındırması gerekir. Böylece, başka bir proje içine kopyalandıklarında, yeni projede yeniden şablon geliştirilmek zorunda kalınmaz. Bunu yapmak için, geliştirdiğimiz proje içerisinde, templates adında bir dizin oluşturup, içerisinde blog_anasayfa.html …