Django 1.0 post_save signal has no attribute 'connect'?
Hi all! Trying the fallowing: from django.db.models import signals print dir(signals.post_save) gives: ['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] and print signals.post_save.connect gives: AttributeError: 'object' object has no attribute 'connect' How can I use signals now? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: add RequestContext automatically to each render_to_response call
On 10 мар, 11:28, Julian <[EMAIL PROTECTED]> wrote: > hi, > > I've been writing a django-application and now I need the > RequestContext for some new features. I don't want to add > context_instance=RequestContext(request) to each render_to_response > call manually in my views.py. > > How can I can I solve my problem? > > I could do this with retrieving the request-object and do something > like this: > > from django.shortcuts import render_to_response as _render_to_response > from django.template import RequestContext > from django.anywher import request > > def render_to_response(*args, **kwargs): > kwargs['context_instance'] = RequestContext(request) > return _render_to_response(*args, **kwargs) You can use also custom decorator, for example: from django.shortcuts import render_to_response from django.template import RequestContext def render_to(tmpl): def renderer(func): def wrapper(request, *args, **kw): output = func(request, *args, **kw) if not isinstance(output, dict): return output return render_to_response(tmpl, output, context_instance=RequestContext(request)) return wrapper return renderer Usage: @render_to('path/to/template.html') def my_cool_view(request): my_var = 'Cool!' return {'myvar':myvar} --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newforms-admin: filter_horizontal doesn't work
On 7 мар, 17:07, Brian Rosner <[EMAIL PROTECTED]> wrote: > > "Hold down "Control", or "Command" on a Mac, to select more than one." > > > and NO select boxes, search input etc! > > What revision of newforms-admin are you using? Also, what browser is > this behavior is displayed in? > > -- > Brian Rosnerhttp://oebfare.com Revision is 0.97-newforms-admin-SVN-7206 Browsers: Firefox 2.0.0.12, IE 6.0.2900.2180 All js scripts are loaded. Also in User edit screen it works fine for Permissions --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Newforms-admin: filter_horizontal doesn't work
Could anybody please explain what are the reasons for filter_horizontal doesn't work in newforms-admin? in models.py for the app: class Block(models.Model): title = models.CharField(max_length=255) code = models.CharField(help_text=u"Допустимы цифры и латинские заглавные буквы", max_length=20, unique=True) active = models.BooleanField(default=True) posts = ManyToManyField(Post) in admin.py for the app: class BlockOptions(admin.ModelAdmin): list_display = ('title', 'code', 'active',) filter_horizontal = ('posts',) admin.site.register(Block, BlockOptions) In the admin area it shows only: "Hold down "Control", or "Command" on a Mac, to select more than one." and NO select boxes, search input etc! When filter_horizontal is commented in the code above, simple multiselect box with "add" link are visible. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newform-admin: problem with loading admin templates and templatetags
On Dec 27, 11:34 am, Julien <[EMAIL PROTECTED]> wrote: > In urls.py, have you set it up properly: > > from django.conf.urls.defaults import * > from django.contrib import admin > > urlpatterns = patterns('', > ('^admin/(.*)', admin.site.root), > ) Naturally, yes! Otherwise admin application didn't start at all. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newform-admin: problem with loading admin templates and templatetags
Jeremy, thanks to reply! > What you really want here is to have > 'django.template.loaders.app_directories.load_template_source' in your > TEMPLATE_LOADERS. That's really what you want, not add add the admin > templates to TEMPLATE_DIRS. This template loader was enabled of cause from the beginning. But it does not help. The traceback is at http://dpaste.com/29095/ When I copy admin templates to my project template folder, I get >"In template d:\projects\nftest\templates\admin\login.html, error at line 4 >'adminmedia' is not a valid tag library: Could not load template library from >django.templatetags.adminmedia, No module named adminmedia" It seems that Django searches templates and tempatetags only in project folder not in django folder. It's strange because django IS in python path and newforms-admin and trunk branches have similar code for template loading, but they behavior in the same environment is different. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Newform-admin: problem with loading admin templates and templatetags
Hi, all! I am trying to switch to the new-form admin branch and created a simple project in test purposes. I installed 0.97-newforms-admin-SVN-6977 and created a test project. When trying to start at 127.0.0.1:8000/admin I got an error TemplateDoesNotExist at /admin/ admin/login.html Ok, I add the path to the settings.TEMPLATE_DIRS: "C:/Python25/Lib/site-packages/django/contrib/admin/templates/" After that, error message changed: TemplateSyntaxError at /admin/ 'adminmedia' is not a valid tag library: Could not load template library from django.templatetags.adminmedia, No module named adminmedia All files exist, i.e. django/contrib/admin/templatetags/adminmedia.py exists My configuration is: Windows XP SP2 Pro Python 2.5 (C:\Python25) Django 0.97-pre-SVN-6964 and 0.97-newforms-admin-SVN-6977 (I switch between them by renaming django folder) Adding of paths to sys.paths etc. had no result - the error appears anyway. When I switch back to the 0.97-pre and start my former project - it works fine. All pathes to the Django are the same in both cases. Django embedded server was used in both cases. As I see, templates and paths in 0.97-pre and 0.97-newform-admin are similar. In both cases Django lives in C:\Python25\Lib\site-packages \django. So I can't to localize the problem. Could anybody help me? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---