Django community: 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 freshwater pearl necklaces
I do believe all the ideas you have offered for your post. They are really convincing and will definitely work. Still, the posts are too short for novices. May just you please extend them a little from next time? Thanks for the post. -
New: Views as a package
This pattern allows for refactoring the view code into several files without effecting the import process in other files. In other words from coolapp.views import foo still works. -
Django-Autocomplete, and all your requests will be complete, but be careful with the horn
Bon, je suis encore en retard pour la django app du mois de juillet, mais je m’améliore, je n’ai plus que 20 jours de retard. Espérons que la django app du mois d’aout soit à l’heure…. En attendant de voir si en août, à l’heure je serais, je vous propose de découvrir cette petite django-app bien sympatique. Mais avant un peu de contexte. Je cherche depuis quelques temps une django app pour faire de l’autocompletion. Djangopackages qui est décidément très souvent mon ami propose un tableau récapitulatif assez sympa d’un certain nombre d’app qui propose cela. Parmi la liste, j’ai décidé de tester django-autocomplete qui me paraissait le mieux répondre à mes besoin, à savoir de l’autocomplete facile coté admin, comme coté site non admin. Nouveauté ce mois si au niveau du billet, je vais vous présenter deux versions de l’app à savoir la version ‘officielle’ faite par tyrion et un fork fait par etienned. Pourquoi vous présentez deux versions ? Parce que la version d’etienned propose quelques améliorations visuelles intéressantes (et quelques petits refactor pas débiles). 1- Où on le trouve, comment on l’installe, tout ça quoi (et la doc) ? Ici cela dépends de la version que vous désirez tester … -
Comentário sobre Configurando um projeto Django no UOL Host – segunda parte por Valder
thank you for your comments, I hope to be helpful :D -
Profiling Django
At the recent WebDev offsite in Portland, we had a chance to spend the day working on any project we wanted and then show the results off that afternoon. I chose to play around with Socket IO. This is also inspired by a great talk by Alexander Bourget at Confoo. A while back I was trying to profile my Django site and find some speed improvements. I started off by looking for a nice way to profile a Django site and give me some output. That's easy, as it turns out there's some code in Django command extensions that outputs profiles: python manage.py runprofileserver --use-cprofile --prof-path=/tmp/output For each request to your Django site this will output in cprofile format a profile of the request, one per file. Now we just need a tool to read it. When Googling this the main blog posts I found covered a format called kcachegrind, which is used by a tool to output some useful information. Unfortunately on a Mac this means using X Windows, Mac ports and a whole pile of stuff. There's MacCallGrind, but that didn't work, just hung. So that's where I started writing something. Talisker is a Socket IO based server … -
Updated: Django Version Reporting
Updated the example script to use Stefan Foulis' PEP 386-compliant example from https://gist.github.com/1149730 -
Virtualenv in new Terminal windows/tabs
How to open new tabs/windows of Terminal with the last virtualenv used -
Agile team seeks talented Software Developer
-
Agile team seeks talented Software Developer
Are you a recent Software Engineering graduate looking to join an Agile team? Or do you have 3 years industry experience and a passion for learning? We're a fast-paced, well-funded Web 2.0 business looking for a pro-active software developer to join our talented, self-organizing software development team. About you You are hungry to learn: You actively seek change — always looking for opportunities to improve professionally, and to help your team develop. You read software-related publications, welcome criticism of your work and offer your colleagues honest feedback. You're willing to try new things: Want to try your hand at requirements gathering or UI design? If the idea of becoming a Generalizing Specialist appeals, this could be the right job for you. You have excellent communication skills: You're comfortable communicating verbally, graphically or in written text, and you’re happy explaining technical concepts to non-technical people. You’re qualified and/or experienced: You have a Software Engineering degree, an equivalent certificate from a leading organization (e.g.: IEEE-CS, BCS) or have at least 3 years experience. You appreciate a sociable, friendly and supportive working environment: We value technical expertise and encourage developers to exercise their initiative and engage with the business as a whole.This is … -
Django Modelleriyle Paket Yöneticisi
Birçok web uygulama ve python geliştiricisi, Django'nun harika bir web çatısı olduğunu düşünür. Ancak, Django'yu bir web çatısı olmakla sınırlandırmak, bence biraz haksızlık olur. Django'nun parçalarının mümkün olduğu kadar birbirinden bağımsız olmasından dolayı, kolaylıkla istediğiniz parçasını, kendi uygulamalarınıza dahil edebilirsiniz. Django'nun kişisel olarak en sevdiğim yanı veritabanı uygulama geliştirme arayüzü olduğu için, Django'nun veritabanı geliştirme arayüzünü nasıl kendi projemize dahil edebileceğimizi göstermek için, küçük bir örnek yapmak istedim.Örneğimizde, çok basit, sadece iki fonksiyondan oluşan bir paket yöneticisi yazacağız. Lütfen örnekdeki kodu çalıştırmaya çalışmayın. Örnek olsun diye yazılmış, bir kez bile denenmemiştir. Bunu açıklığa kavuşturduğumuza göre, işe koyulalım. İlk iş, uygulamanız için bir dizin oluşturup, içinde bir Django projesine başlamak. mkdir PaketYoneticisi cd PaketYoneticisi django-admin.py startproject veritabani cd veritabani django-admin.py startapp Paket Gerekli dizin yapılanmasını ayarladıktan sonra, Django projesi ayarlarından gereksiz kısımları atabilirsiniz. Sadece veritabanı kullanacağımız için, şu kadar ayar yeterli olacaktır: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'paketler.db', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty … -
Django Modelleriyle Paket Yöneticisi
Birçok web uygulama ve python geliştiricisi, Django'nun harika bir web çatısı olduğunu düşünür. Ancak, Django'yu bir web çatısı olmakla sınırlandırmak, bence biraz haksızlık olur. Django'nun parçalarının mümkün olduğu kadar birbirinden bağımsız olmasından dolayı, kolaylıkla istediğiniz parçasını, kendi uygulamalarınıza dahil edebilirsiniz. Django'nun kişisel olarak en sevdiğim yanı veritabanı uygulama geliştirme arayüzü olduğu için, Django'nun veritabanı geliştirme arayüzünü nasıl kendi projemize dahil edebileceğimizi göstermek için, küçük bir örnek yapmak istedim.Örneğimizde, çok basit, sadece iki fonksiyondan oluşan bir paket yöneticisi yazacağız. Lütfen örnekdeki kodu çalıştırmaya çalışmayın. Örnek olsun diye yazılmış, bir kez bile denenmemiştir. Bunu açıklığa kavuşturduğumuza göre, işe koyulalım. İlk iş, uygulamanız için bir dizin oluşturup, içinde bir Django projesine başlamak. mkdir PaketYoneticisi cd PaketYoneticisi django-admin.py startproject veritabani cd veritabani django-admin.py startapp Paket Gerekli dizin yapılanmasını ayarladıktan sonra, Django projesi ayarlarından gereksiz kısımları atabilirsiniz. Sadece veritabanı kullanacağımız için, şu kadar ayar yeterli olacaktır: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'paketler.db', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty … -
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 …