Re: Calling some javascript for new visitors only
What is stopping you from doing the cookie check itself with JavaScript which is quite capable to do that :-) http://www.quirksmode.org/js/cookies.html http://plugins.jquery.com/project/cookie On Wed, Jul 7, 2010 at 11:55 AM, euan.godd...@googlemail.comwrote: > You'll need to do the test in the view and then pass the result of the > test into the template. > > On Jul 7, 10:13 am, grimmus wrote: >> Hi, >> >> I need to show a javascript lightbox popup for new visitors to my >> site. >> >> I presume using a cookie is the best way to achieve this. But how can >> i check whether the cookie exists in my template, so i can call some >> javascript code if it's a new visitor ? >> >> I hope i have been clear, >> >> Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: python logging and multiple process issue?
Are you wanting to log errors that occur in your django site? If that's the case I'd recommend starting with simple tools like django's email logging and working up to more sophisticated tools like django-db-log or arecibo. If you want to debug development code or you will find python's built in logging will be just fine for all but the most complicated of use cases. If you want to do access logging, your web server does that for you. -- Andy McKay, @andymckay Django Consulting, Training and Support -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Streaming File Uploads with Lighttpd+Django
Nevermind, I finally found my answer after hours of searching in this thread: http://forum.lighttpd.net/topic/1142 On Jul 12, 11:08 pm, Chriswrote: > Hi all, > > I just recently deployed my django site from the included development > webserver to a production server with lighttpd. I'm new to both > Lighttpd and Django so forgive my ignorance. When using the > development webserver, I can see streaming files in the tmp directory > grow if the uploaded file is >2.5mb as Django says. However, on my > lighttpd configuration, it seems to keep the file in memory, because > it doesn't show the temporary file in the tmp directory until the > entire file has been uploaded. This will be a problem as I'm planning > on uploading files anywhere from 5mb- 5gb. I'm not sure if there is > something I need to set, or if lighty is streaming the upload but just > to a different directory. > > Also, if anyone has any links or advice on large file uploads, please > send them over...I'd love to know if there is a better approach. > > Thanks in advance! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: python logging and multiple process issue?
After reading your message, I googled and found this from you - http://code.google.com/p/modwsgi/wiki/DebuggingTechniques I guess this is what you are referring to. does it mean - 1) any uncaught exceptions from my code running under mod_wsgi are automatically logged in apache log files? or 2) I need to do in my code try: . except Exception,e: print >> sys.stderr, " error in method xyz, exception:", e thanks On Jul 12, 8:18 pm, Graham Dumpletonwrote: > What is wrong with letting it log to stderr and thus the Apache error > log files? > > Graham > > On Jul 13, 11:52 am, ydjango wrote: > > > Just checking, if anyone can point me to a good solution to it. Or > > logging to sockets as in official doc is the best solution. > > > On Jul 11, 9:35 am, ydjango wrote: > > > > Python logging has know limitation with multiple processes logging to > > > same file. > > > (I am using rotatingfilehandler.) > > > > Which in case of prefork MPM will always be an issue and can be an > > > issue for worker mpm as well? > > > > Python doc recommends logging to sockets. > > > > What workarounds are you using and can recommend ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: python logging and multiple process issue?
You mean by using simple print statements. I used to do that when I was on mod_python. Then I moved to using mod_wsgi and read somewhere that mod_wsgi does not log print statements. I may have been mistaken. On Jul 12, 8:18 pm, Graham Dumpletonwrote: > What is wrong with letting it log to stderr and thus the Apache error > log files? > > Graham > > On Jul 13, 11:52 am, ydjango wrote: > > > Just checking, if anyone can point me to a good solution to it. Or > > logging to sockets as in official doc is the best solution. > > > On Jul 11, 9:35 am, ydjango wrote: > > > > Python logging has know limitation with multiple processes logging to > > > same file. > > > (I am using rotatingfilehandler.) > > > > Which in case of prefork MPM will always be an issue and can be an > > > issue for worker mpm as well? > > > > Python doc recommends logging to sockets. > > > > What workarounds are you using and can recommend ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: python logging and multiple process issue?
What is wrong with letting it log to stderr and thus the Apache error log files? Graham On Jul 13, 11:52 am, ydjangowrote: > Just checking, if anyone can point me to a good solution to it. Or > logging to sockets as in official doc is the best solution. > > On Jul 11, 9:35 am, ydjango wrote: > > > > > Python logging has know limitation with multiple processes logging to > > same file. > > (I am using rotatingfilehandler.) > > > Which in case of prefork MPM will always be an issue and can be an > > issue for worker mpm as well? > > > Python doc recommends logging to sockets. > > > What workarounds are you using and can recommend ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Streaming File Uploads with Lighttpd+Django
Hi all, I just recently deployed my django site from the included development webserver to a production server with lighttpd. I'm new to both Lighttpd and Django so forgive my ignorance. When using the development webserver, I can see streaming files in the tmp directory grow if the uploaded file is >2.5mb as Django says. However, on my lighttpd configuration, it seems to keep the file in memory, because it doesn't show the temporary file in the tmp directory until the entire file has been uploaded. This will be a problem as I'm planning on uploading files anywhere from 5mb- 5gb. I'm not sure if there is something I need to set, or if lighty is streaming the upload but just to a different directory. Also, if anyone has any links or advice on large file uploads, please send them over...I'd love to know if there is a better approach. Thanks in advance! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: python logging and multiple process issue?
Just checking, if anyone can point me to a good solution to it. Or logging to sockets as in official doc is the best solution. On Jul 11, 9:35 am, ydjangowrote: > Python logging has know limitation with multiple processes logging to > same file. > (I am using rotatingfilehandler.) > > Which in case of prefork MPM will always be an issue and can be an > issue for worker mpm as well? > > Python doc recommends logging to sockets. > > What workarounds are you using and can recommend ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
New tutorial added to Django by Example
I've added a new tutorial: A Photo Organizer and Sharing App to my Django by Example site. As always, feedback is appreciated. This tutorial illustrates the use of tags, ratings, albums, sharing, searching, filtering and sorting. http://LightBird.net/dbe/ -ak -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Help Converting a Query getting one result using .filter() to .get()
Why does it matter? You could just say next_game[0] instead. J On Jul 12, 4:28 pm, Chris McComaswrote: > I have this query, trying to get the next game in the future. > > today = datetime.datetime.now() > next_game = Game.objects.filter(date__gt=today).order_by('date')[:1] > > I need to use .get() if possible, instead of .filter() how can I do > this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Help Converting a Query getting one result using .filter() to .get()
I have this query, trying to get the next game in the future. today = datetime.datetime.now() next_game = Game.objects.filter(date__gt=today).order_by('date')[:1] I need to use .get() if possible, instead of .filter() how can I do this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Mass Hosting on mod_wsgi?
On Jul 13, 1:04 am, ringemupwrote: > Hi folks -- > > I'm planning on mass hosting a SaaS project built on Django, using > Apache and mod_wsgi. There will be hundreds of domains running off a > single copy of the project code; each domain has a different Site ID > and settings file, and can have its own Virtual Host (I'm also willing > to serve them all off the same VirtualHost if that's simpler). > > I need some help figuring out what the VirtualHost directives and WSGI > scripts should look like in order to a) serve all the sites cleanly > and without conflict, and b) ideally avoid duplication of code as much > as possible (in case, for instance, we have to change our default WSGI > script down the line.) > > I've googled around a bit, but haven't really seen anything that seems > to cover our use case. Has anyone done this before? Can you offer > any pointers? How much of the documentation on the official mod_wsgi site have you read? Your use case is basically the standard deployment method, duplicated for each VirtualHost. I could suggest some alternatives to that to support a common WSGI script file, but still allow a way of restarting a single daemon process by touching a file specific to each site, eg., that sites settings file. Before doing that though would like to see that you have the standard deployment method working first and understand that else if I start talking about improvements to that without you have actually got the standard method working first, then may just confuse you. Also would need to know what naming strategy you are going to use for the site specific settings files. If know that can describe alternative in a way that makes sense to you rather than you having to translate it. Graham -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Go to the admin change password page instead my template since django-registration update
Hi! Since I update my django-registration installation to be able to use signals, I lost my templates to change password, reset password... There is now the default django admin templates to do that. How can I use again my templates? Do you need some paste or more info? This is my urls.py, it is imported in the project as: (r'^accounts/', include('networking.urls')), from django.conf.urls.defaults import * from registration.views import register from views import show_business, get_qrcode from forms import edit_profile, RegistrationFormTOSAndUniqueEmail, edit_or_delete_business, add_business, initial_setup from django.views.generic.simple import redirect_to urlpatterns = patterns('', # django-registration url(r'^register/$', register, {'backend': 'registration.backends.default.DefaultBackend', 'form_class': RegistrationFormTOSAndUniqueEmail }, name='registration_register'), #(r'^activate/complete/$', redirect_to, {'url': '/'}), (r'^profile/$', redirect_to, {'url': '/'}), url(r'^profile/edit$', edit_profile, name='edit_profile'), (r'^', include('registration.backends.default.urls')), ) -- Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt and/or .pptx http://mirblu.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Trouble writing a view for a model
I think a choice field is probably best, then you can customize the presentation in a forms file. class Question(models.Model): q_cjoices = ( ('choice1', 'choice1'), ('choice2', 'choice2'), ('choice3', 'choice3'), ('choice4', 'choice4'), ('choice5', 'choice5'), ) title = modelsForeignKey(Title) choices = models.CharField(choices=q_choices, max_length=100) In the form declaration you can use this from models.Questions import q_choices from django.forms.extras.widgets import RadioSelect choices = forms.CharField(choices=q_choices, widget=RadioSelect) That would work unless you want someone to be able add choices based on individual questions in which case you'll need to use a many to many field, something like this: Question(models.Model) title = models.ForeignKey(Title) Choice = models.ManyToManyField(Choice) class Choice(models.CharField) choice_1 = models.CharField( etc. etc. etc. On Jul 12, 4:21 pm, rupertwrote: > Thanks for replying. > > I'm ultimately trying to create a feedback form where there is a list > of say 10 questions with 5 choices for response to each question. It > also needs to be editable in the admin (and I can't get forms to be > editable in the admin). > > On Jul 12, 5:11 pm, Rodion Raskolnikiv wrote: > > > Rupert, > > Without knowing what you are aiming to accomplish, my advice might not > > be pertinent. However, it looks like your models could be rearranged > > like this: > > > class Question(models.Model): > > question = models.CharField(max_length=200) > > pub_date = models.DateTimeField('date published') > > > class Choice(models.Model): > > poll = models.ForeignKey(Question) > > choice = models.CharField(max_length=200) > > votes = models.IntegerField() > > > (Slightly modified from:http://docs.djangoproject.com/en/dev/intro/ > > tutorial01/) > > > On Jul 12, 1:49 pm, rupert wrote: > > > > For this code: > > > > class Title(models.Model): > > > title = models.CharField(max_length=200) > > > pub_date = models.DateTimeField('date published') > > > > def __unicode__(self): > > > return self.title > > > > def was_published_today(self): > > > return self.pub_date.date() == datetime.date.today() > > > > class Question(models.Model): > > > title = models.ForeignKey(Title) > > > question = models.CharField(max_length=200) > > > choice1 = models.CharField(max_length=200) > > > choice2 = models.CharField(max_length=200) > > > choice3 = models.CharField(max_length=200) > > > choice4 = models.CharField(max_length=200) > > > choice5 = models.CharField(max_length=200) > > > > def __unicode__(self): > > > return self.question > > > > I'm trying to write a view where it outputs like this > > > > Question > > > > Choice 1-choice 5 in a radio button -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Trouble writing a view for a model
Thanks for replying. I'm ultimately trying to create a feedback form where there is a list of say 10 questions with 5 choices for response to each question. It also needs to be editable in the admin (and I can't get forms to be editable in the admin). On Jul 12, 5:11 pm, Rodion Raskolnikivwrote: > Rupert, > Without knowing what you are aiming to accomplish, my advice might not > be pertinent. However, it looks like your models could be rearranged > like this: > > class Question(models.Model): > question = models.CharField(max_length=200) > pub_date = models.DateTimeField('date published') > > class Choice(models.Model): > poll = models.ForeignKey(Question) > choice = models.CharField(max_length=200) > votes = models.IntegerField() > > (Slightly modified from:http://docs.djangoproject.com/en/dev/intro/ > tutorial01/) > > On Jul 12, 1:49 pm, rupert wrote: > > > For this code: > > > class Title(models.Model): > > title = models.CharField(max_length=200) > > pub_date = models.DateTimeField('date published') > > > def __unicode__(self): > > return self.title > > > def was_published_today(self): > > return self.pub_date.date() == datetime.date.today() > > > class Question(models.Model): > > title = models.ForeignKey(Title) > > question = models.CharField(max_length=200) > > choice1 = models.CharField(max_length=200) > > choice2 = models.CharField(max_length=200) > > choice3 = models.CharField(max_length=200) > > choice4 = models.CharField(max_length=200) > > choice5 = models.CharField(max_length=200) > > > def __unicode__(self): > > return self.question > > > I'm trying to write a view where it outputs like this > > > Question > > > Choice 1-choice 5 in a radio button -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: must be μ
2010/7/12 Alessandro Ronchi: > I want django to return μ instead of the html enscaped form in my > views, because I need it to return a reportlab template wich doesn't handle > the escaped version. > I already have an unicode template and unicode output, so I only those > characters not to convert to their HTML version. Isn't this simply the matter of running it through the template tag "safe"? {{ your_output_string|safe }} should output the unicode data verbatim. > > Is it possible? > How? > > Thanks in advance, > -- > Alessandro Ronchi > http://www.soasi.com > > Hobby & Giochi > http://hobbygiochi.com > http://www.facebook.com/hobbygiochi > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > Best regards Martin Melin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Trouble writing a view for a model
Rupert, Without knowing what you are aiming to accomplish, my advice might not be pertinent. However, it looks like your models could be rearranged like this: class Question(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') class Choice(models.Model): poll = models.ForeignKey(Question) choice = models.CharField(max_length=200) votes = models.IntegerField() (Slightly modified from:http://docs.djangoproject.com/en/dev/intro/ tutorial01/) On Jul 12, 1:49 pm, rupertwrote: > For this code: > > class Title(models.Model): > title = models.CharField(max_length=200) > pub_date = models.DateTimeField('date published') > > def __unicode__(self): > return self.title > > def was_published_today(self): > return self.pub_date.date() == datetime.date.today() > > class Question(models.Model): > title = models.ForeignKey(Title) > question = models.CharField(max_length=200) > choice1 = models.CharField(max_length=200) > choice2 = models.CharField(max_length=200) > choice3 = models.CharField(max_length=200) > choice4 = models.CharField(max_length=200) > choice5 = models.CharField(max_length=200) > > def __unicode__(self): > return self.question > > I'm trying to write a view where it outputs like this > > Question > > Choice 1-choice 5 in a radio button -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Error related to googlebot?
Thank you for your reply. I have now tried disabling cookies, javascript and referer, and I was still unable to reproduce any of the errors. Here is a sample errormessage, with everything included: Traceback (most recent call last): File "/usr/local/lib/python2.6/site-packages/django/core/handlers/ base.py", line 80, in get_response response = middleware_method(request) File "/usr/local/lib/python2.6/site-packages/django/middleware/ common.py", line 57, in process_request if (not _is_valid_path(request.path_info, urlconf) and File "/usr/local/lib/python2.6/site-packages/django/middleware/ common.py", line 143, in _is_valid_path urlresolvers.resolve(path, urlconf) File "/usr/local/lib/python2.6/site-packages/django/core/ urlresolvers.py", line 301, in resolve return get_resolver(urlconf).resolve(path) File "/usr/local/lib/python2.6/site-packages/django/core/ urlresolvers.py", line 214, in resolve for pattern in self.url_patterns: File "/usr/local/lib/python2.6/site-packages/django/core/ urlresolvers.py", line 243, in _get_url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.6/site-packages/django/core/ urlresolvers.py", line 238, in _get_urlconf_module self._urlconf_module = import_module(self.urlconf_name) File "/usr/local/lib/python2.6/site-packages/django/utils/ importlib.py", line 35, in import_module __import__(name) File "/home/users/presskanne/dcalcuttagutta/urls.py", line 7, in admin.autodiscover() File "/usr/local/lib/python2.6/site-packages/django/contrib/admin/ __init__.py", line 24, in autodiscover import_module('%s.admin' % app) File "/usr/local/lib/python2.6/site-packages/django/utils/ importlib.py", line 35, in import_module __import__(name) File "/home/users/presskanne/dcalcuttagutta/articles/admin.py", line 10, in from dcalcuttagutta.articles.models import Article, ArticleVersion, Comment, CommentVersion, Category, Tag File "/home/users/presskanne/dcalcuttagutta/articles/models.py", line 19, in from dcalcuttagutta.members.models import Member File "/home/users/presskanne/dcalcuttagutta/members/models.py", line 82, in class MemberCreationForm(UserCreationForm): File "/home/users/presskanne/dcalcuttagutta/members/models.py", line 105, in MemberCreationForm language_interface = forms.ModelChoiceField(queryset = Language.objects.filter(interface_translation = True)) #Language of calcuttagutta interface File "/usr/local/lib/python2.6/site-packages/django/db/models/ manager.py", line 141, in filter return self.get_query_set().filter(*args, **kwargs) File "/usr/local/lib/python2.6/site-packages/django/db/models/ query.py", line 550, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/usr/local/lib/python2.6/site-packages/django/db/models/ query.py", line 568, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/usr/local/lib/python2.6/site-packages/django/db/models/sql/ query.py", line 1131, in add_q can_reuse=used_aliases) File "/usr/local/lib/python2.6/site-packages/django/db/models/sql/ query.py", line 1026, in add_filter negate=negate, process_extras=process_extras) File "/usr/local/lib/python2.6/site-packages/django/db/models/sql/ query.py", line 1182, in setup_joins field, model, direct, m2m = opts.get_field_by_name(name) File "/usr/local/lib/python2.6/site-packages/django/db/models/ options.py", line 291, in get_field_by_name cache = self.init_name_map() File "/usr/local/lib/python2.6/site-packages/django/db/models/ options.py", line 321, in init_name_map for f, model in self.get_all_related_m2m_objects_with_model(): File "/usr/local/lib/python2.6/site-packages/django/db/models/ options.py", line 396, in get_all_related_m2m_objects_with_model cache = self._fill_related_many_to_many_cache() File "/usr/local/lib/python2.6/site-packages/django/db/models/ options.py", line 410, in _fill_related_many_to_many_cache for klass in get_models(): File "/usr/local/lib/python2.6/site-packages/django/db/models/ loading.py", line 167, in get_models self._populate() File "/usr/local/lib/python2.6/site-packages/django/db/models/ loading.py", line 64, in _populate self.load_app(app_name) File "/usr/local/lib/python2.6/site-packages/django/db/models/ loading.py", line 78, in load_app models = import_module('.models', app_name) File "/usr/local/lib/python2.6/site-packages/django/utils/ importlib.py", line 35, in import_module __import__(name) File "/home/users/presskanne/dcalcuttagutta/media_files/models.py", line 17, in from dcalcuttagutta.articles.models import Tag ImportError: cannot import name Tag , POST:, COOKIES:{}, META:{'DOCUMENT_ROOT': '/home/users/presskanne/www', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': '*/*', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_CONNECTION': 'close', 'HTTP_FROM': 'googlebot(at)googlebot.com', 'HTTP_HOST':
Re: Javascript string catalogs (jsi18n) - accessing strings in project/locale?
Hi, I know this comes late, but for the future reference: My problem was that I had "locale" directory in *project* directory, "myproject/locale" but I didn't have myproject in INSTALLED_APPS. So the thing that contains localization strings *must* be ALSO in the INSTALLED_APPS = [..., 'myproject'] On 8 kesä, 16:13, Stodgewrote: > I ran makemessages -d djangojs from my project level directory, and > Django automatically generated the .po file in project/locale/. I > followed the documentation (and the book The Definitive Guide to > Django) but I cannot access these translated strings. The catalog is > always empty. My urls contains: > > js_info_dict = { > 'packages': ('django.conf',), > > } > > But this doesn't work. I tried: > > js_info_dict = { > 'packages': ('project_name',), > > } > > As this is package name for the project directory, but no dice. So how > do I access the strings in my project directory? > > Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Easiest way to pass variables between modelforms (genericforms)
Derek, Cool, thanks for that. I wonder if something similar would work on passing values to a formset... Erich On Jul 8, 1:17 am, derekwrote: > On Jul 7, 12:44 am, Erich wrote: > > > I am using create_update.create_object to handle my forms (generic > > forms both use modelforms). I have two forms. The second relies on the > > pk of the first as a fk. I can't figure out what is the best practice > > to A: save the pk as a variable or into the session, then B: pull that > > variable either out of the session or another place, such as a global > > variable. > > > I could write the forms manually, but this does not seem to be the > > most efficient way, unless create_object was meant for very simple > > forms. I have tried using extra_context to call another function, but > > I dont know if that is the best way either. > > Maybe have a look > at:http://www.petersanchez.com/2008/09/26/django-formwizard-passing-data... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Trouble writing a view for a model
For this code: class Title(models.Model): title = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.title def was_published_today(self): return self.pub_date.date() == datetime.date.today() class Question(models.Model): title = models.ForeignKey(Title) question = models.CharField(max_length=200) choice1 = models.CharField(max_length=200) choice2 = models.CharField(max_length=200) choice3 = models.CharField(max_length=200) choice4 = models.CharField(max_length=200) choice5 = models.CharField(max_length=200) def __unicode__(self): return self.question I'm trying to write a view where it outputs like this Question Choice 1-choice 5 in a radio button -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: must be μ
Try mark_safe. from django.utils.safestring import mark_safe mark_safe('μ') 2010/7/12 Alessandro Ronchi> I want django to return μ instead of the html enscaped form in my > views, because I need it to return a reportlab template wich doesn't handle > the escaped version. > I already have an unicode template and unicode output, so I only those > characters not to convert to their HTML version. > > Is it possible? > How? > > Thanks in advance, > -- > Alessandro Ronchi > http://www.soasi.com > > Hobby & Giochi > http://hobbygiochi.com > http://www.facebook.com/hobbygiochi > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt and/or .pptx http://mirblu.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
must be μ
I want django to return μ instead of the html enscaped form in my views, because I need it to return a reportlab template wich doesn't handle the escaped version. I already have an unicode template and unicode output, so I only those characters not to convert to their HTML version. Is it possible? How? Thanks in advance, -- Alessandro Ronchi http://www.soasi.com Hobby & Giochi http://hobbygiochi.com http://www.facebook.com/hobbygiochi -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
__init__ custom form validation
I am working on a validation that will require a field be filled in if it is another field enters on of three values: For example: I have a form class myform(forms.Modelform): field1 = forms.CharField field2 = forms.Charfield field3_type = forms.CharField(choices=choices) field3 = forms.DateTimeField(required=True) def __init__(self, field3_type, *args, **kwargs): super(myform, self_.__init__(*args, **kwargs) if field3_type in ('option 1', 'option 2', 'option 3'): self.field['field3'] = forms.DateTiemField(required=False) The view: if request.method == 'POST': form = myform(request.POST) field3_type = form.cleaned_data['field3_type'] if form.is_valid(): # some form processing else: form = myform() When i try to use the form I get an error at the myform() line stating that __init__ takes exactyl 2 arguments and only 1 is given. Any thoughts? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Error related to googlebot?
On 07/12/2010 01:10 PM, Tor Nordam wrote: So my question is if there is anything in particular which might cause the page to crash when a searchbot tries to load it, but not do the same for a regular user. Well, additional information about the HTTP transaction might help. Bots may or may not include any of a subset of the following: Refe(r)rer Cookies JavaScript So you might try tweaking your browser (FF has some nice plugins for controlling these various bits) to refrain from processing any of these and see if it makes a difference. -tkc -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Error related to googlebot?
I'm currently writing a blog framework in django, and I have it up an running (on www.presskanne.com). During the last 20 hours or so, I have gotten about 60 emails with error 500 messages. They seem to originate from different pages all over the site, but they all have two things in common: The tracebacks all show that the problem is in importing one particular model The clients are all either googlebot or yahoo slurp Also, I can't reproduce any of the errors myself. When I visit the offending urls, everything either seems fine, or in the case of a nonexistent page, I get a nice 404 message. So my question is if there is anything in particular which might cause the page to crash when a searchbot tries to load it, but not do the same for a regular user. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
get_profile() with AUTH_PROFILE_MODULE set on an abstract class
Hello, I am currently encountering an issue and have been unable to figure out a solution by myself or through the internet. Here is what I'm trying to do : I would like to setup profiles for the two different categories of people who are going to run my website (something like teacher/ students; both profiles don't have the exact same fields requirements). Hence, I tried to subclass Django's User class into another class, UserProfile, which is the one that is refered to in settings.py through AUTH_PROFILE_MODULE. I have no problem so far. When I try to create two classes who inherit the UserProfile one, I come up with the following error : 'NoneType' object has no attribute '_default_manager' when trying to access request.user.get_profile(). After reading most of the topics that are related to that error, I'm still unable to figure out where my problem stands. Could it be because of the Class Meta : abstract = True that my UserProfile class contains? Is there another clean way to do this (I though I could maybe put all the fields into UserProfile, most of them would then remain blank since they are not relevant for both profile, but it seems to me that that solution would be rather dirty). Thanks in advance for your time, J.L. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Odd Issue Updating Model Values -- They get wrapped in parenthesis and quotes
Hello, I am having an odd issue updating a table (I don't have this issue on any other table)... When I update the value it gets wrapped in ('NEW_VALUE',) when it should just be NEW_VALUE. Current Value in DB Desired New Value -- Before Saving PerezPerez Current Value in DB Desired New Value -- After Saving ('Perez',)Perez Here is the code: *** DOESN'T WORK *** def updateYouth(youth,line): print "Current Value\tNew Value -- Before Saving\n{0:16} {1:16}".format(youth.name_last, line['Youth - Last Name'].title().strip()) if len(line['Youth - First Name']) > 0: youth.name_first=line['Youth - First Name'].title().strip(), if len(line['Youth - Middle Name']) > 0: youth.name_middle=line['Youth - Middle Name'].title().strip(), if len(line['Youth - Last Name']) > 0: youth.name_last=line['Youth - Last Name'].title().strip(), youth.save() print "Current Value\tNew Value -- After Saving\n{0:16} {1:16}".format(youth.name_last, line['Youth - Last Name'].title().strip()) .. name_first = models.CharField(max_length=255, verbose_name="First Name") name_middle = models.CharField(max_length=255, blank=True, verbose_name="Middle Name") name_last = models.CharField(max_length=255, verbose_name="Last Name") . *** DOES WORK *** def updateParent(parent,which,line): if len(line['Parent '+which+' - First Name']) > 0: parent.name_first=line['Parent '+which+' - First Name'].title().strip() if len(line['Parent '+which+' - Middle Name']) > 0: parent.name_middle=line['Parent '+which+' - Middle Name'].title().strip() if len(line['Parent '+which+' - Last Name']) > 0: parent.name_last=line['Parent '+which+' - Last Name'].title().strip() . name_first = models.CharField(max_length=255, verbose_name="First Name") name_middle = models.CharField(max_length=255, blank=True, verbose_name="Middle Name") name_last = models.CharField(max_length=255, verbose_name="Last name") . Any Ideas? Thanks, Michael -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: way to detecting visitiors zip code
There are various tools to map a visitor's IP to their zip code: http://www.google.com/search?hl=en=ip+to+zip That would be where I would start with such a project... On Jul 12, 7:53 am, haibinwrote: > hi all, > > Is there a way to get the visitor's location represented as zip code > (not only in US)? I have no idea how to do this, please help. > > Thanks, > James -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
displaying template item based on url
Does anyone know how to display certain template items based on url? For example. http://localhost/aeditpage/varX/ http://localhost/anothereditpage/varY I want to check if it aeditpage or anothereditpage before I decide what pieces of the template to display. In the page I grab data from a database and display it. How do I access page variables so I can display them in the template? I'm trying to pass a particular variable via the url and need access to a particular table ID. thanx Gondor -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to pass a GET param that contains multiple items
Thanks, Euan! Margie On Jul 11, 2:00 am, "euan.godd...@googlemail.com"wrote: > This is a standard encode/decode situation you are descibing. Django > automatically decodes the GET string the the browser encodes. If you > need spaces, then they wil be encoded and decoded appropriately, so > don't worry about that. > > If you want to pass a list in the GET string, do: > > url?var=1=2=3 > > Django will intepret this in it's multi-value dict implementation that > QueryDict uses. So if you do: > > request.GET.getlist('var') > > you will get: > > ['1', '2', '3'] > > Hope that helps, Euan > > On 10 July, 23:40, Margie Roginski wrote: > > > I have a url in my app that needs to get info from a GET param. For > > example, let's say my url is retrieving books by any of a set of > > authors, so the url might be this to get books authored by smith, > > johnson, or klein: > > >www.example.com/books/?author=smith+johnson+klein > > > I notice that when I look at request.GET.get('author') on the server, > > the '+' is gone and replaced by space: > > > > > > Is this django doing this for me or is this some sort of general http > > protocal thing? > > > My main question is just - what's the accepted way to pass in a get > > parameter that contains a bunch of times. What if the parameter > > itself has spaces? I've seen this '+' used - is that standard or just > > personal preference? > > > Thanks, > > Margie -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Developing Facebook Apps
Hi, I've been trying to build facebook apps on Google App Engine using the Google App Engine Helper. I've set up dyndns to point to my network so I can develop locally, but it's not working as planned. When I try to go to my domain Ex: something.gotdns.org:8000 or go to the facebook app that has this callback url it can't communicate with my local machine where I'm building the app. However, when I go on a different machine and go to my domain, I'm able to communicate with my app. Does anyone know how to set up the local development machine so it can communicate with the app? Thank you so much in advance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Developing Facebook Apps
Hi, I've been trying to build facebook apps on Google App Engine using the Google App Engine Helper. I've set up dyndns to point to my network so I can develop locally, but it's not working as planned. When I try to go to my domain Ex: something.gotdns.org:8000 or go to the facebook app that has this callback url it can't communicate with my local machine where I'm building the app. However, when I go on a different machine and go to my domain, I'm able to communicate with my app. Does anyone know how to set up the local development machine so it can communicate with the app? Thank you so much in advance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Mass Hosting on mod_wsgi?
Hi folks -- I'm planning on mass hosting a SaaS project built on Django, using Apache and mod_wsgi. There will be hundreds of domains running off a single copy of the project code; each domain has a different Site ID and settings file, and can have its own Virtual Host (I'm also willing to serve them all off the same VirtualHost if that's simpler). I need some help figuring out what the VirtualHost directives and WSGI scripts should look like in order to a) serve all the sites cleanly and without conflict, and b) ideally avoid duplication of code as much as possible (in case, for instance, we have to change our default WSGI script down the line.) I've googled around a bit, but haven't really seen anything that seems to cover our use case. Has anyone done this before? Can you offer any pointers? Thanks! -Nan -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Queryset returning modelinstances of manytomany relationship?
Say I have 2 classes as: class Bar(models.Model): prop = IntegerField() class Foo(models.Model): bar = ManyToManyField(Bar) I want to return a QuerySet containing model instances of bar that match the query: QuerySetOfFoos.objects.filter(bar__prop__gt=0) Is there an easy way to do this? I know that in the model instance I could do foo.bar_set but not sure how to do it over all of the original QuerySet... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
way to detecting visitiors zip code
hi all, Is there a way to get the visitor's location represented as zip code (not only in US)? I have no idea how to do this, please help. Thanks, James -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: www.djangoproject.com
On Jul 12, 3:40 pm, Nick Raptiswrote: > Yea, for some reason, my thoughts went to Weave too. Maybe it has > something to do with it, maybe it doesn't. Haven't got any more trouble > since I fixed it though. > Glad I could help :) I'm using Weave too, don't think that's a coincidence. Bye, Andi -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Access Foreignkey ID without doing query? (Merging Foreignkey/M2M) (manual select_related)
Uhh, you are right... it does work! I though I was writing a pseudo code (without testing that my pseudo code indeed worked already)... Sometimes Django is intuitive to extent it guesses what I wanted! Though foreignkey documentation did not include information that I can access the raw ID like "host_id". And BTW I ended up using dict to cache the ID's myself too. On 12 heinä, 15:21, Daniel Rosemanwrote: > On Jul 12, 11:29 am, Jari Pennanen wrote: > > > > > > > Hi! > > > Is it possible to access the foreignkey ID value of model? I do not > > want Django ORM to try to make query because it fails in this case. I > > have exact same problem > > ashttp://groups.google.com/group/django-users/browse_thread/thread/d24f... > > (though I'm not using admin, I have list view of my own) > > > I will use the same example: > > > Host > > name = CharField > > Account > > name = CharField > > host = ForeignKey(Host, related_name='accounts') > > > I have list of "Host" where I need to also list on each item a list of > > accounts. Now if I could access the raw "Account.host" foreignkey ID I > > could do this in two queries: > > > hosts = list(Host.objects.all()) > > accounts = list(Account.objects.filter(host__in=hosts)) > > > for h in hosts: > > h.account_list = [a for a in accounts if a.host_id == h.id] # > > NOTICE: THIS is not possible! I cannot access the foreignkey host_id : > > ( > > Why not? What happens? This is the correct way to access the foreign > key ID. > > Note that if you get this working, you'll be iterating through all the > selected accounts each time, for every Host. If you've got large > numbers of accounts, there is a slightly more efficient way of doing > this, by using dictionaries to pre-group the accounts by their > matching hosts: see my blog[1] for an explanation. > -- > DR. > > [1]:http://blog.roseman.org.uk/2010/01/11/django-patterns-part-2-efficien... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: www.djangoproject.com
I too have upgraded my Ubuntu systems over several versions in the past, and also have Weave (now Firefox Sync) installed since a few weeks, which leaves me wondering how the nonstandard setting got into the profile in the first place. Yea, for some reason, my thoughts went to Weave too. Maybe it has something to do with it, maybe it doesn't. Haven't got any more trouble since I fixed it though. Glad I could help :) Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django Redirect App / Google Analytics
I'm using the Django Redirect app (http://docs.djangoproject.com/en/ dev/ref/contrib/redirects/) but I'd like to have Google Analytics track the urls that's I'm redirecting. Is there an standard way to do something like this without hacking the Django core? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Dajax or Jquery
I never saw Dajax, but after reading I see it supports Jquery. I use mootools and Jquery and both are great. Dajax just seem to integrate them into django a little easier. On Jul 12, 6:36 am, Imad Elharoussiwrote: > Hi, > > I want to know what's the best plugin of Ajax to use with django Dajax or > Jquery (for someone who just began in developping with such technologies) > > Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: www.djangoproject.com
On 08.07.2010 17:12, Nick Raptis wrote: In firefox, check your preffered language settings, in the content tab. If there is a non-standard value there (perhaps "/etc/locale/prefs.conf" or something) instead of a locale like en-US, some django pages won't ever display. Many thanks also from me! I too had the exact same problem, and your fix helped. I too have upgraded my Ubuntu systems over several versions in the past, and also have Weave (now Firefox Sync) installed since a few weeks, which leaves me wondering how the nonstandard setting got into the profile in the first place. Anyways, many thanks for your post! Best, Carsten -- Cafu - the open-source Game and Graphics Engine for multiplayer, cross-platform, real-time 3D Action Learn more at http://www.cafu.de smime.p7s Description: S/MIME Cryptographic Signature
Did anybody ever move the filter column (admin) on the left?
I know it's just messign with the css files, but there are a lot of lines marked with ".filter", not counting the grey border fo the main table when the filter list is taller than the "instances" box. I was wondering if anybody has a css files with the modified lines to include in the Media class of the Admin interface. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
RE: 'django.contrib.comments', Error: No module named comments.
Oops! I had 'comments' in my settings.py installed apps for some reason... removed and works fine -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
RE: 'django.contrib.comments', Error: No module named comments.
Oops! I had 'comments' in my settings.py installed apps for some reason... removed and works fine -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: 'django.contrib.comments', Error: No module named comments. Can someone explain why?
You already have correct 'django.contrib.comments' in INSTALLED_APPS. Why did you add another 'comments' as last element? On Jul 12, 2010, at 4:14 PM, justin jools wrote: > I've set up basic blog with, all running fine but when I runserver I > get Error: No module named comments. I've checked the Python path > (below) and the app/function is there. Can someone explain why it is > isn't finding this when it finds all other installed apps e.g. markup, > tagging. > > C:\Python26\Lib\site-packages\django\contrib\comments > > INSTALLED_APPS = ( >'django.contrib.auth', >'django.contrib.contenttypes', >'django.contrib.sessions', >'django.contrib.sites', >'django.contrib.admin', >'django.contrib.comments', >'django.contrib.markup', >'portfolio', >'basic.blog', >'basic.inlines', >'tagging', >'comments', > ) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
'django.contrib.comments', Error: No module named comments. Can someone explain why?
I've set up basic blog with, all running fine but when I runserver I get Error: No module named comments. I've checked the Python path (below) and the app/function is there. Can someone explain why it is isn't finding this when it finds all other installed apps e.g. markup, tagging. C:\Python26\Lib\site-packages\django\contrib\comments INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'django.contrib.comments', 'django.contrib.markup', 'portfolio', 'basic.blog', 'basic.inlines', 'tagging', 'comments', ) Many Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: reversing admin urls
On 12/07/10 11:27, bigfudge wrote: > Hi - is it possible to reverse admin urls for user-apps? For example, > if I have an app named "Survey" and a model named "Question", is there > a consistent format for reversing the url to edit this model in the > admin interface (by default this would be /admin/survey/question/) > http://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls {% url admin:survey_question_change question.id %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: reversing admin urls
On Jul 12, 11:27 am, bigfudgewrote: > Hi - is it possible to reverse admin urls for user-apps? For example, > if I have an app named "Survey" and a model named "Question", is there > a consistent format for reversing the url to edit this model in the > admin interface (by default this would be /admin/survey/question/) > > Many thanks, > > B http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#reversing-admin-urls -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Access Foreignkey ID without doing query? (Merging Foreignkey/M2M) (manual select_related)
On Jul 12, 11:29 am, Jari Pennanenwrote: > Hi! > > Is it possible to access the foreignkey ID value of model? I do not > want Django ORM to try to make query because it fails in this case. I > have exact same problem > ashttp://groups.google.com/group/django-users/browse_thread/thread/d24f... > (though I'm not using admin, I have list view of my own) > > I will use the same example: > > Host > name = CharField > Account > name = CharField > host = ForeignKey(Host, related_name='accounts') > > I have list of "Host" where I need to also list on each item a list of > accounts. Now if I could access the raw "Account.host" foreignkey ID I > could do this in two queries: > > hosts = list(Host.objects.all()) > accounts = list(Account.objects.filter(host__in=hosts)) > > for h in hosts: > h.account_list = [a for a in accounts if a.host_id == h.id] # > NOTICE: THIS is not possible! I cannot access the foreignkey host_id : > ( Why not? What happens? This is the correct way to access the foreign key ID. Note that if you get this working, you'll be iterating through all the selected accounts each time, for every Host. If you've got large numbers of accounts, there is a slightly more efficient way of doing this, by using dictionaries to pre-group the accounts by their matching hosts: see my blog[1] for an explanation. -- DR. [1]: http://blog.roseman.org.uk/2010/01/11/django-patterns-part-2-efficient-reverse-lookups/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
reversing admin urls
Hi - is it possible to reverse admin urls for user-apps? For example, if I have an app named "Survey" and a model named "Question", is there a consistent format for reversing the url to edit this model in the admin interface (by default this would be /admin/survey/question/) Many thanks, B -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Please unsubscribe this email
;? Have you tried to read the signature? On Mon, Jul 12, 2010 at 13:34, David Allywrote: > Please unsubscribe this email. > > > David > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt and/or .pptx http://mirblu.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Please unsubscribe this email
Please unsubscribe this email. David -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Dajax or Jquery
On 12/07/10 11:36, Imad Elharoussi wrote: > Hi, > > I want to know what's the best plugin of Ajax to use with django Dajax or > Jquery (for someone who just began in developping with such technologies) > They don't do the same thing? jquery is a purely client-side javascript toolkit, whereas dajax is an ajax helper framework for django. dajax targets jquery as one of the client-side javascript toolkits it supports for implementing its client-side bits. So you use dajax with jquery (or dajax+prototype or dajax+mootools or dajax+dojo). Of course, dajax's goal is to hide the javascript, so in a sense you do end up writing less jquery client-side code. OTOH you don't have to use dajax to do ajax with django if you don't want to. You might (for argument's sake) feel it does a little "too much" (thought n.b. you can use "dajaxice" that dajax sits on top on its own), and roll your own functions on the server side using django's request.is_ajax() and json serialiser and write your own jquery (and/or one of the other toolkits) javascript code on the client side. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
model instances, schema and template variables
Hi, Just want to know if this is the correct understanding of how model instances are passed to templates. If I load a model instance object into a template - is it the case that I also implicitly load in any instance objects it is related through foreign key fields? It seems that these, and in turn, any foreign keys those objects have, are also loaded. eg return render_to_response("startpage.html", { 'A': instance1, }, context_instance=RequestContext(request)) so in the template I can do things like: {{ A.fk_field.name }} {{ A.fk_field.another_fk_field.name}} Is this correct - and how should it be controlled - supposing I really do only want 'instance1' without FK following. Is it also the case if I want access to an instance's reverse relationship objects I have to explicitly load those into the template seperately? eg return render_to_response("startpage.html", { 'A': instance1, 'BList': instance1.other_set.all(), }, context_instance=RequestContext(request)) so in the template I can do {% for B in BList %} do something with B {% endfor %} Sorry if this is answered elsewhere but just couldn't find it! Thanks Alex -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Dajax or Jquery
Hi, I want to know what's the best plugin of Ajax to use with django Dajax or Jquery (for someone who just began in developping with such technologies) Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Access Foreignkey ID without doing query? (Merging Foreignkey/M2M) (manual select_related)
Hi! Is it possible to access the foreignkey ID value of model? I do not want Django ORM to try to make query because it fails in this case. I have exact same problem as http://groups.google.com/group/django-users/browse_thread/thread/d24f2a502da3171c?pli=1 (though I'm not using admin, I have list view of my own) I will use the same example: Host name = CharField Account name = CharField host = ForeignKey(Host, related_name='accounts') I have list of "Host" where I need to also list on each item a list of accounts. Now if I could access the raw "Account.host" foreignkey ID I could do this in two queries: hosts = list(Host.objects.all()) accounts = list(Account.objects.filter(host__in=hosts)) for h in hosts: h.account_list = [a for a in accounts if a.host_id == h.id] # NOTICE: THIS is not possible! I cannot access the foreignkey host_id : ( -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how do I add a custom button (url) to the admin add/change page
You might want to take a look at overriding admin templates: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates - Sævar On Jul 12, 8:38 am, gondorwrote: > I'm trying to add a simple button to a specific add/change page. This > button takes the user to another url. I'm trying to have a https url > form popup in a separate window. > > I have looked in the documentation and all over google but have not > success. Does anyone know how to do this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to access help_text attribute of model field
On Jul 11, 11:47 pm, "Sells, Fred"wrote: > I don't intend to use these names as column names but as content of a column, > used for debugging as much as anything else. I'm new to Django, so I had not > thought of verbose name. I really had not anticipated using the help_text at > all when I defined my models, but a situation came up where I needed to do a > > Name --- value description type of table. > > is there an advantage of verbosename over helptext in my scenario? It depends. If you're using the admin, or any auto-generated forms, the verbose_name will be used in place of the field name for the field labels on the form - I presume that will be more helpful for your users than the code names you have. The help_text is displayed in small grey text underneath the field. However, if you're not using the admin at all in your project, then there's no difference for you. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: binding data to form
On Jul 12, 8:27 am, djnubbiowrote: > def anag_form(request, anag_id=None): > if anag_id is None: > x=Anagrafica.objects.create() > else: > x=Anagrafica.objects.get(pk=anag_id) > > form = AnagraficaForm(request.POST or None, instance=x) # A form > bound to the POST data > if form.is_valid(): # All validation rules pass > form.save() > return HttpResponseRedirect('/ListaAnagrafica/') # Redirect > after POST > > return render_to_response('condomini/anag_edit.html', {'form': > form,}) > this works fine...almost > > when i try to insert new data with the empty form, data are correctly > added to my database, but an empty record also is added to my table. > > Any help will be greatly appreciated. > thank The call to `create` actually creates and save a new instance, then you create it again on form.save. Instead of doing create, just instantiate a blank object without saving: if anag_id is None: x=Anagrafica() -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
binding data to form
Hi all and tank very much for your preciouse time I have the following scenario: #models.py class Anagrafica(models.Model): GENERE_CHOICES = ( (u'M', u'Maschio'), (u'F', u'Femmina'), ) cognome = models.CharField(max_length=20) nome = models.CharField(max_length=20) indirizzo=models.CharField(max_length=30) def __unicode__(self): return self.cognome+" "+self.nome #urls.py (r'^anag_edit/(?P\d+)/$', 'condor.condomini.forms.anag_form'), (r'^anag_edit/$', 'condor.condomini.forms.anag_form'), #forms.py from django import forms from condor.condomini.models import * from django.shortcuts import render_to_response, get_object_or_404, redirect from django.template import RequestContext from django.http import HttpResponseRedirect class AnagraficaForm(ModelForm): class Meta: model = Anagrafica def anag_form(request, anag_id=None): if anag_id is None: x=Anagrafica.objects.create() else: x=Anagrafica.objects.get(pk=anag_id) form = AnagraficaForm(request.POST or None, instance=x) # A form bound to the POST data if form.is_valid(): # All validation rules pass form.save() return HttpResponseRedirect('/ListaAnagrafica/') # Redirect after POST return render_to_response('condomini/anag_edit.html', {'form': form,}) #anag_edit.html {% extends "base_menu.html" %} {% block title %}Editing Anagrafica{% endblock %} {% block content %} {% csrf_token %} {{ form.as_p }} {% endblock %} this works fine...almost when i try to insert new data with the empty form, data are correctly added to my database, but an empty record also is added to my table. Any help will be greatly appreciated. thank -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: cannot add many projects to users in ADMIN
On Monday 12 July 2010 11:19:42 pROCKrammer wrote: > I have two models: http://pastebin.com/pcf2ngdy > > But in admin page i cant add more than one project to the user ... > could you help me ... please > use ManyToMany instead of ForeignKey if you want a user to have more than one project. Also it is not a good idea to have a model called 'User' as the admin module also has a model User. -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
how do I add a custom button (url) to the admin add/change page
I'm trying to add a simple button to a specific add/change page. This button takes the user to another url. I'm trying to have a https url form popup in a separate window. I have looked in the documentation and all over google but have not success. Does anyone know how to do this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
cannot add many projects to users in ADMIN
I have two models: http://pastebin.com/pcf2ngdy But in admin page i cant add more than one project to the user ... could you help me ... please -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.