Re: decorating an include in urls.py

2012-07-06 Thread Alexandr Aibulatov
Try to use this library https://github.com/jeffkistler/django-decorator-include 2012/7/6 Gelonida N : > I'd like to decorate all views in an include. > > Let's take for example: > > urlpatterns = patterns('', > url(r'^decorated_admin/', include(admin.site.urls)), > ) > > >

Re: Django ModelForm user best practices

2012-05-30 Thread Alexandr Aibulatov
For example on second method i can change post, board id's via html, and write to board where i can be banned. I think we shoudn't override standart methods if we con don't override them(this about third method) P.S. sorry for my terrible english. 2012/5/31 Kurtis Mullins

Re: Django ModelForm user best practices

2012-05-30 Thread Alexandr Aibulatov
I think that the first method is the most usefull. On second method some experience users can override hidden data. And it's a bad idea to override __init__ and save method in my humble opinion/ 2012/5/31 RM : > Say there's a model: > > class Notification(models.Model): >    

Re: Different urls.py file for different apps

2012-05-22 Thread Alexandr Aibulatov
you could include urls of app into your_app/urls.py urlpatterns = patterns('', (r'your_app/', include('your_apps.urls')) (r'your_app2/', include('your_apps2.urls')) ) 2012/5/22 siddharth56660

Re: ajax call says: "NetworkError: 500 INTERNAL SERVER ERROR - http://127.0.0.1:8000/ajax/"

2012-05-05 Thread Alexandr Aibulatov
Your view should return an HttpResponse Object. Your view prints 'test' and returns NoneType Object. Yours view should be like this: from django.http import HttpResponse def ajax(request): return HttpResponse('test', mimetype="text/plain") 2012/5/5 doniyor : >

Re: Modify __unicode__

2012-05-02 Thread Alexandr Aibulatov
Use in __unicode__ method strftime     def __unicode__(self):     return "%s %s" % (self.name, self.date_created.strftime("%A %d %B") Look at strftime: http://docs.python.org/library/datetime.html?highlight=strftime#datetime.date.strftime 2012/5/2 Nikhil Verma :

Re: HELP with unicode!!!!!

2012-05-01 Thread Alexandr Aibulatov
Write at first line on your py file: # -*- coding: utf-8 -*- 2012/5/1 dizzydoc : > Hi , > > i have lost a lot of time looking for a solution. > > My problem is, while i a reading csv in python using > > csv_file  = open(path_file, "rb") > reader = csv.reader(csv_file)

Re: Trouble with query syntax in Django view

2012-05-01 Thread Alexandr Aibulatov
First of all. Student.objects.filter(pk=id) returns QuerySet not instance of Student. If you want get current student use get_object_or_404()(https://docs.djangoproject.com/en/1.4/topics/http/shortcuts/#get-object-or-404) or Student.objects.get(pk=id). Teacher and parents can bee retrived via

Re:: Trouble with query syntax in Django view

2012-04-30 Thread Alexandr Aibulatov
You can get teacher and parents objects from student instance. student.teacher and student.teachers.all() 01.05.2012 11:46 пользователь "LJ" написал: > I have a Student model that stores information about a student, > including the student's teacher. > The teacher's

Re: Sessions living through HttpResponseRedirect

2012-04-24 Thread Alexandr Aibulatov
Set request.session.modified = True 2012/4/24 sspross : > Hi Joshua > > What was your solution here? It looks like I'm having the same kind of > problem like you: > > http://stackoverflow.com/questions/10293467/losing-session-after-httpresponseredirect > > Thx! > > Regards, >

Re: Tutorial issue with admin

2012-04-11 Thread Alexandr Aibulatov
You can add list_display = ['question', ] on your PollAdmin class. 2012/4/11 Romain Gaches : > you just have to define a __unicode__ method [1] in your model > > [1] > https://docs.djangoproject.com/en/1.4/ref/models/instances/#django.db.models.Model.__unicode__ > > > Le

Re: Looking for Django IDE

2012-04-01 Thread Alexandr Aibulatov
Try to use vim with plugins for django. 02.04.2012 1:48 пользователь "Mark Phillips" написал: > What IDE do you use/recommend for developing django web sites? Or, if not > an IDE, what editor/setup is most useful? I am developing on Linux version > 3.1.0-1-amd64