newbie: mysql backend "Error was: cannot import name conversions" with subversion build of django
Hi I just started using the subversion build of django and mysql- python with python 2.6.3 Both django (svn 12103) and _mysql (MySQLdb rev 635) work fine and can be imported from the command line python without any error messages. I created a new django testproject and then modified my settings.py to use the mysql backend ( see DATABASE section below). But when I start python manage.py runserver 8080 , I get an error which I am reproducing here indicating that the backend was not started. Any ideas on what I need to change to have my django launch with the mysql backend. Thanks harijay The error I get is ^Chariharan-jayarams-macbook-pro-17:testdjnew hari$ python manage.py runserver 8080 Validating models... Unhandled exception in thread started by Traceback (most recent call last): File "/Users/hari/djtrunk/django/core/management/commands/ runserver.py", line 48, in inner_run self.validate(display_num_errors=True) File "/Users/hari/djtrunk/django/core/management/base.py", line 249, in validate num_errors = get_validation_errors(s, app) File "/Users/hari/djtrunk/django/core/management/validation.py", line 22, in get_validation_errors from django.db import models, connection File "/Users/hari/djtrunk/django/db/__init__.py", line 74, in connection = connections[DEFAULT_DB_ALIAS] File "/Users/hari/djtrunk/django/db/utils.py", line 75, in __getitem__ backend = load_backend(db['ENGINE']) File "/Users/hari/djtrunk/django/db/utils.py", line 37, in load_backend raise ImproperlyConfigured(error_msg) django.core.exceptions.ImproperlyConfigured: 'django.db.backends.mysql' isn't an available database backend. Try using django.db.backends.XXX, where XXX is one of: 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3' Error was: cannot import name conversions My settings.py has nothing special after my new settings.py creation other than the following database section: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'mytestdb', # Or path to database file if using sqlite3. 'USER': 'root', # Not used with sqlite3. 'PASSWORD': 'mypass', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } } -- 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 with a query :$
On Tue, Jan 5, 2010 at 8:09 AM, greatlemerwrote: > On Jan 5, 4:00 am, Marc Aymerich wrote: > > Hi! > > I have a model like this: > > > > class company(models.model): > > name = models.CharField(mx_length=20) > > class employee(models.model): > > comany = models.ForeignKey(company) > > class user(models.model): > > person = models.OneToOneField(person) > > > > One company can have multiple employees but one employee only can have > one > > user. > > > > I know how to get all employees for a company > > > > company.objects.get(name='companyname').employee_set.all() > > > > But.. How can I get all users for a company? > > > > I try with > > > > > user.objects.get(employee=company.objects.get(name='companyname').employee_ > set.all()) > > company.objects.get(name='companyname').employee_set.all().user > > > > but this approach only works with a single object, like this: > > > > > user.objects.get(employee=company.objects.get(name='companyname').employee_ > set.all()[2]) > > company.objects.get(name='companyname').employee_set.all()[2].user > > > > any idea in how can I get all users for a company? > > > > Thanks a lot! > > Marc. > > You want to use filter [1] with something like: > user.objects.filter(employee__company__name='companyname') > > >[1] > http://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-specific-objects-with-filters > -- > > G > Thank you very much!! :D > > -- > > 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: Help with a query :$
On Jan 5, 4:00 am, Marc Aymerichwrote: > Hi! > I have a model like this: > > class company(models.model): > name = models.CharField(mx_length=20) > class employee(models.model): > comany = models.ForeignKey(company) > class user(models.model): > person = models.OneToOneField(person) > > One company can have multiple employees but one employee only can have one > user. > > I know how to get all employees for a company > > company.objects.get(name='companyname').employee_set.all() > > But.. How can I get all users for a company? > > I try with > > user.objects.get(employee=company.objects.get(name='companyname').employee_ > set.all()) > company.objects.get(name='companyname').employee_set.all().user > > but this approach only works with a single object, like this: > > user.objects.get(employee=company.objects.get(name='companyname').employee_ > set.all()[2]) > company.objects.get(name='companyname').employee_set.all()[2].user > > any idea in how can I get all users for a company? > > Thanks a lot! > Marc. You want to use filter [1] with something like: user.objects.filter(employee__company__name='companyname') [1] http://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-specific-objects-with-filters -- G -- 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 Gantt Chart
http://code.google.com/p/django-graphviz/ On Mon, Jan 4, 2010 at 9:42 PM, Hinnackwrote: > what about: > http://matplotlib.sourceforge.net/ > > -- > Hinnack > > 2010/1/4 Daniel Hilton > > 2010/1/4 Alessandro Ronchi : >> > I need to make a simple chart with a list of projects and a grafic >> > display of the end date with a link to the project page. >> > It's simpler than a gantt chart. >> > >> > Is there any library / snippet I can use to simplify my work? >> > >> >> Hmmm, as I'm about to do something similar I've also researched this. >> >> If you're just looking at displaying a list of objects(projects) then >> you can use a generic view and then handle the display in the >> template, which means the following links may be of help: >> >> http://www.jlion.com/docs/gantt.aspx >> http://www.jsgantt.com/ >> >> Niether of which are particularly pretty but the basics are there >> ready to be reskinned. >> >> http://www.ext-scheduler.com/examples.html >> >> Is however, pretty awesome, if commercially licensed. >> >> This question on stackoverflow is pretty extensive as well: >> http://stackoverflow.com/questions/1005587/gantt-chart-online >> >> If I don't find one I like, I'm thinking about writing a template tag >> and some jQuery to make a nice dependency graph. >> HTH, >> Dan >> >> >> >> >> > -- >> > Alessandro Ronchi >> > >> > http://www.soasi.com >> > SOASI - Sviluppo Software e Sistemi Open Source >> > >> > http://hobbygiochi.com >> > Hobby & Giochi, l'e-commerce del divertimento >> > >> > -- >> > >> > 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. >> > >> > >> > >> >> >> >> -- >> Dan Hilton >> >> www.twitter.com/danhilton >> www.DanHilton.co.uk >> >> >> -- >> >> 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. > -- 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.
Search box: Nothing to repeat error
I want to allow a user to search for a value and return the results using the object_list generic view. How can I get this working? business_search.html: {% block content %} Business name: {% endblock content %} urls.py: (r'^?business=(?P\w+)/','businessnamesearch_view'), views.py: (field in models.py to search on is named business) def businessnamesearch_view(request, business_name): business = Business.objects.filter (business__icontains=business_name) return object_list(request, queryset=business) I have a template, business_list.html that works already. I get the error: Request Method: GET Request URL:http://127.0.0.1:8000/business/?business=AB Exception Type: error Exception Value:nothing to repeat -- 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: TypeError: 'CharField' object is not callable
On Monday 04 January 2010 23:54:13 Marc Aymerich wrote: > ... > take a look at middle_initial of woman class ;) Thank you very much for the fast and accurate response. Now it worked without problem. signature.asc Description: This is a digitally signed message part.
Re: TypeError: 'CharField' object is not callable
On Tue, Jan 5, 2010 at 5:24 AM, hakovawrote: > Hi all, > > I am a 'very' inexperienced django user with no programming > background, so please be gentle with me :). > > I just typed the following models.py file under my project_name/ > app_name: > > # -*- coding: utf-8 -*- > from django.db import models > > # Create your models here. > class Couple(models.Model): >coupleid = models.AutoField('Couple ID', primary_key=True) >entry_date = models.DateField('Date Entered') >home_address1 = models.CharField(max_length=200) >home_address2 = models.CharField(max_length=200) >home_phone = models.CharField(max_length=20) > > class Woman(models.Model): >couple = models.ForeignKey(Couple) >lastname = models.CharField(max_length=100) >firstname = models.CharField(max_length=100) >middle_initial = models.CharField = models.CharField(max_length=1) >ssn = models.PositiveIntegerField('SSN') >dob = models.DateField('Date of Birth') >cell_phone = models.CharField(max_length=20) >email = models.EmailField() >picture = models.ImageField(upload_to="photos/") >work_address1 = models.CharField(max_length=200) >work_address2 = models.CharField(max_length=200) >work_phone = models.CharField(max_length=20) >fax = models.CharField(max_length=20) > > class Man(models.Model): >couple = models.ForeignKey(Couple) >lastname = models.CharField(max_length=100) >firstname = models.CharField(max_length=100) >middle_initial = models.CharField = models.CharField(max_length=1) >ssn = models.PositiveIntegerField('SSN') >dob = models.DateField('Date of Birth') >cell_phone = models.CharField(max_length=20) >email = models.EmailField() >picture = models.ImageField(upload_to="photos/") >work_address1 = models.CharField(max_length=200) >work_address2 = models.CharField(max_length=200) >work_phone = models.CharField(max_length=20) >fax = models.CharField(max_length=20) > > Then I ran the command as described in tutorial 1: > python manage.py sql app_name > > However, it gives me the error message listed on the subject line. > Entire message is posted below: > > Traceback (most recent call last): > File "manage.py", line 11, in >execute_manager(settings) > File "/usr/lib/python2.6/site-packages/django/core/management/ > __init__.py", line 362, in execute_manager >utility.execute() > File "/usr/lib/python2.6/site-packages/django/core/management/ > __init__.py", line 303, in execute >self.fetch_command(subcommand).run_from_argv(self.argv) > File "/usr/lib/python2.6/site-packages/django/core/management/ > base.py", line 195, in run_from_argv >self.execute(*args, **options.__dict__) > File "/usr/lib/python2.6/site-packages/django/core/management/ > base.py", line 221, in execute >self.validate() > File "/usr/lib/python2.6/site-packages/django/core/management/ > base.py", line 249, in validate >num_errors = get_validation_errors(s, app) > File "/usr/lib/python2.6/site-packages/django/core/management/ > validation.py", line 28, in get_validation_errors >for (app_name, error) in get_app_errors().items(): > File "/usr/lib/python2.6/site-packages/django/db/models/loading.py", > line 131, in get_app_errors >self._populate() > File "/usr/lib/python2.6/site-packages/django/db/models/loading.py", > line 58, in _populate >self.load_app(app_name, True) > File "/usr/lib/python2.6/site-packages/django/db/models/loading.py", > line 74, in load_app >models = import_module('.models', app_name) > File "/usr/lib/python2.6/site-packages/django/utils/importlib.py", > line 35, in import_module >__import__(name) > File "/home/~/../project_name/app_name/models.py", line 12, in > >class Woman(models.Model): > File "/home/~/../project_name/app_name/models.py", line 19, in Woman >cell_phone = models.CharField(max_length=20) > TypeError: 'CharField' object is not callable > > Any ideas, pointers will be very much appreciated. > > take a look at middle_initial of woman class ;) > -- > > 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.
TypeError: 'CharField' object is not callable
Hi all, I am a 'very' inexperienced django user with no programming background, so please be gentle with me :). I just typed the following models.py file under my project_name/ app_name: # -*- coding: utf-8 -*- from django.db import models # Create your models here. class Couple(models.Model): coupleid = models.AutoField('Couple ID', primary_key=True) entry_date = models.DateField('Date Entered') home_address1 = models.CharField(max_length=200) home_address2 = models.CharField(max_length=200) home_phone = models.CharField(max_length=20) class Woman(models.Model): couple = models.ForeignKey(Couple) lastname = models.CharField(max_length=100) firstname = models.CharField(max_length=100) middle_initial = models.CharField = models.CharField(max_length=1) ssn = models.PositiveIntegerField('SSN') dob = models.DateField('Date of Birth') cell_phone = models.CharField(max_length=20) email = models.EmailField() picture = models.ImageField(upload_to="photos/") work_address1 = models.CharField(max_length=200) work_address2 = models.CharField(max_length=200) work_phone = models.CharField(max_length=20) fax = models.CharField(max_length=20) class Man(models.Model): couple = models.ForeignKey(Couple) lastname = models.CharField(max_length=100) firstname = models.CharField(max_length=100) middle_initial = models.CharField = models.CharField(max_length=1) ssn = models.PositiveIntegerField('SSN') dob = models.DateField('Date of Birth') cell_phone = models.CharField(max_length=20) email = models.EmailField() picture = models.ImageField(upload_to="photos/") work_address1 = models.CharField(max_length=200) work_address2 = models.CharField(max_length=200) work_phone = models.CharField(max_length=20) fax = models.CharField(max_length=20) Then I ran the command as described in tutorial 1: python manage.py sql app_name However, it gives me the error message listed on the subject line. Entire message is posted below: Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "/usr/lib/python2.6/site-packages/django/core/management/ __init__.py", line 362, in execute_manager utility.execute() File "/usr/lib/python2.6/site-packages/django/core/management/ __init__.py", line 303, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/python2.6/site-packages/django/core/management/ base.py", line 195, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/lib/python2.6/site-packages/django/core/management/ base.py", line 221, in execute self.validate() File "/usr/lib/python2.6/site-packages/django/core/management/ base.py", line 249, in validate num_errors = get_validation_errors(s, app) File "/usr/lib/python2.6/site-packages/django/core/management/ validation.py", line 28, in get_validation_errors for (app_name, error) in get_app_errors().items(): File "/usr/lib/python2.6/site-packages/django/db/models/loading.py", line 131, in get_app_errors self._populate() File "/usr/lib/python2.6/site-packages/django/db/models/loading.py", line 58, in _populate self.load_app(app_name, True) File "/usr/lib/python2.6/site-packages/django/db/models/loading.py", line 74, in load_app models = import_module('.models', app_name) File "/usr/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module __import__(name) File "/home/~/../project_name/app_name/models.py", line 12, in class Woman(models.Model): File "/home/~/../project_name/app_name/models.py", line 19, in Woman cell_phone = models.CharField(max_length=20) TypeError: 'CharField' object is not callable Any ideas, pointers will be very much appreciated. -- 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 with a query :$
Hi! I have a model like this: class company(models.model): name = models.CharField(mx_length=20) class employee(models.model): comany = models.ForeignKey(company) class user(models.model): person = models.OneToOneField(person) One company can have multiple employees but one employee only can have one user. I know how to get all employees for a company company.objects.get(name='companyname').employee_set.all() But.. How can I get all users for a company? I try with user.objects.get(employee=company.objects.get(name='companyname').employee_set.all()) company.objects.get(name='companyname').employee_set.all().user but this approach only works with a single object, like this: user.objects.get(employee=company.objects.get(name='companyname').employee_set.all()[2]) company.objects.get(name='companyname').employee_set.all()[2].user any idea in how can I get all users for a company? Thanks a lot! Marc. -- 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: ModelMultipleChoiceField for a ManyToManyField relation to attach Images to a blogpost by using BlogForm
Hey Daniel, Thanks for response, as always helpful and quick. Like you suggested I changed the fields to the class. This resulted in a error because BlogForm could not be found. So I decided not to bother the photologue model but import the Images into the blog model. This resulted in: * blog models.py ** from photos.models import Image, Pool class blog(models.Model) class Post(models.Model): blog = models.ForeignKey(blog) item= models.CharField(_('item'), max_length=200) imagepost = models.ManyToManyField(Image, blank=True, verbose_name=_('post')) * blog forms.py ** class BlogForm(forms.ModelForm): slug = forms.SlugField(max_length=20, help_text = _("a short version of the title consisting only of letters, numbers, underscores and hyphens."), error_message = _("This value must contain only letters, numbers, underscores and hyphens."), imagepost = forms.ModelMultipleChoiceField (queryset=Image.objects.all()) def __init__(self, user=None, *args, **kwargs): self.user = user super(BlogForm, self).__init__(*args, **kwargs) self.fields["imagepost"].queryset = Image.objects.all() class Meta: model = Post exclude = ('author', 'creator_ip', 'created_at', 'updated_at', 'publish') This resolves is in a AttributeError 'module' object has no attribute 'objects'. This is strange because the photos view uses a similar queryset: photos = Image.objects.filter(member=request.user) Again i just like to render the titles/urls of the images to attach them to the posts. Cheers -- 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: Generic view object_detail on a m2m relationship
Try to make a loop in the template, I guess that may can work 2010/1/5 Delacroy Systems> This is how I did it in views.py: > > def businessshowservice_view(request, business_id): >business = Business.objects.get(pk=business_id) >services = Business.objects.get(pk=business_id).service_set.all() >return object_list(request, queryset=services, > extra_context={'business' : business} >) > > (now just have to figure out a way to get my stress back!) > > On Jan 4, 7:55 pm, Delacroy Systems wrote: > > I see that using object_detail is the 'incorrect' generic view to show > > details. I am exploring other options, including writing a custom view > > to give me what I want. > > > > On Jan 4, 8:29 am, Delacroy Systems wrote: > > > > > I am trying to use the generic view, object_detail on a m2m > > > relationship. I have multiple businesses that offer multiple services. > > > I would like to show the services offered by each business. At the > > > moment, I see all the services - not just the services that a > > > particular business is offering. > > > > > In models.py: > > > class Business(models.Model): > > > business = models.CharField(max_length=100) > > > > > class Service(models.Model): > > > service = models.CharField(max_length=100) > > > providers = models.ManyToManyField(Business, through = > > > "BusinessService") > > > > > class BusinessService(models.Model): > > > business = models.ForeignKey(Business) > > > service = models.ForeignKey(Service) > > > > > In urls.py: > > > def get_service(): > > > return Service.objects.all() > > > > > businessservice_list = { > > > #'queryset' : BusinessService.objects.all(), > > > 'queryset' : Business.objects.all(), > > > 'extra_context': {'service_list': get_service} > > > > > ...skip some detail... > > > (r'^showservice/(?P\d+)/$', list_detail.object_detail, > > > businessservice_list), > > > > > In business_detail.html: > > > {% block content %} > > > Business Services > > > {% if object %} > > > {{ object.business }} > > > {{ service_list }} > > > {% endif %} > > > {% endblock content%} > > > > > > -- > > 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. > > > -- Deng Chao -- 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.
Creating multiple related objects to a given QuerySet without evaluating the QuerySet
I have a QuerySet of Books, and I want to create an Action for each Book in that QuerySet. I want to avoid evaluating the Books QuerySet, but the only way I can think of doing what I want to do evaluates it. For example, def create_actions(books, action) books is a QuerySet of Book""" for book in books: Action(book=book, action=action).save() any suggestions on how I can do this without evaluating books? -- 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.
adding custom variables to the Meta class
I have an class that I created which takes a queryset, and a field on the model that the queryset represents. Like this: mc = MyClass(queryset=MyModel.objects.all(), lat_lng_field='lat_lng') The class basically filters the queryset based on some geographical values, but in order to do that, it needs to know which field the coordinates are stored in. Right now I have no choice but require you to pass in a string representing the field name. But I think a better way would be to do it kind of like this: class MyModel(models.Model): lat_lng = PointField() name = CharFIeld(max_length=20) class Meta: verbose_name_plural = 'My Models' lat_lng_field = 'lat_lng' Then just modify MyClass to get the field name from the Model's Meta class. Is this possible somehow? If not, whats the best way to go about this without having to pass in the field name directly? -- 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.
Models, forms and inlineformset
Hi, to begin with I would like to declare that I'm still on the beginner end of the scale when it comes to Python and Django. I have an app which has two models: class Item(models.Model): title = models.CharField() description_markdown = models.TextField() class ItemImage(models.Model): item = models.ForeignKey(Item) image = models.ImageField(upload_to='tmp') What I want to do now is to create a page where users can submit an item and upload an image (or images) at the same time. I can create a form using ModelForm for the Item-model and I can create a form for the ItemImage-model using inlineformset_factory, if I do this the submit page looks like it should. However it doesn't behave the way I want it to when saving, but to be honest I have no real idea of what I'm doing when it comes to the related model/form. If I understand it correctly when using inlineformset_factory I must give it an instance so that it can map the foreignkey, correct? So how do one go about and create a form where people can add "item" and "itemimages" at the same time? I'm feeling totaly lost any pointers would be greatly appreciated. -- Stefan Nitsche ste...@nitsche.se -- 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.
Trying to implement a unique default relationship between models
Hello, I'm trying to implement a default relationship between models. Each otherApp.Partner model can have zero or more Registration models. One Registration per otherApp.Partner can be flagged as the default (default_reg). What I would like is for the default_reg boolean to be configurable from the Admin. I've written up the code below. Save properly updates the other Relationships, but the Admin form validation won't allow (unique error) another Registration to be set as the default, until the first Registration is unflagged. How do I override the form validation or have it ignore the unique constraint, because it is handled in the model save method? Or is there a better way to do this? class BasePartnerModel(BaseRFModel): """ Adds the partner key to the model. """ partner = ForeignKey('otherApp.Partner') class Meta: abstract = True class Registration(BasePartnerModel): """ When a user registers with us before registering with a partner, we need to send the user's information to the partner. This model tracks where to send the registration information, and maps the results between the partner and us.""" # TrueNoneField from http://www.djangosnippets.org/snippets/1831/ default_reg = TrueNoneField(default=None,verbose_name=_('default'),help_text=_('Default registration if one is not specifed, if no default, first one is used.')) def save(self, force_insert=False, force_update=False): if self.default_reg is True: # if this is the new default, set others to False Registration.objects.filter(partner=self.partner).exclude(pk=self.pk).update(default_reg=None) super(Registration, self).save(force_insert, force_update) # Call the "real" save() method. class Meta: unique_together = (('partner','default_reg'),) -- Eric Chamberlain -- 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, Apache, mod_wsgi, GET works, POST doesn't
Can you make it fail in the development server, with DEBUG turned on? If so, you can get more helpful error display and/or do pdb.set_trace() and poke around. On Mon, Jan 4, 2010 at 4:25 PM, Patrick Maywrote: > Hi, > > I have Django running under Apache with mod_wsgi. I've got a simple URL > handler that looks like this: > > def handler(request): > response = None > > if request.method == 'POST' or request.method == 'PUT': > response = HTTPResponse(status=201) > elif request.method == 'GET': > response = HttpResponse("Success") > else: > raise Http404 > > return response > > My django.wsgi looks like this: > > import os > import sys > > sys.path.append('/Users/Patrick/codestreet/src/rest') > > os.environ['DJANGO_SETTINGS_MODULE'] = 'server.settings' > > import django.core.handlers.wsgi > > application = django.core.handlers.wsgi.WSGIHandler() > > When I connect to the URL for the handler with a GET like this: > > request = urllib2.Request(self.URL) > > it works fine, returning a 200. However, when I connect with a POST like > this: > > request = urllib2.Request(self.URL,self.data) > > I get an exception thrown with a 500 code and this in the Apache error log: > > [Mon Jan 04 16:20:08 2010] [error] [client ::1] mod_wsgi (pid=48698): > Exception occurred processing WSGI script > '/Users/Patrick/codestreet/src/rest/django.wsgi'. > [Mon Jan 04 16:20:08 2010] [error] [client ::1] IOError: failed to write data > > Do I have something misconfigured? > > Thanks, > > Patrick > > -- > > 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: Django, Apache, mod_wsgi, GET works, POST doesn't
On Jan 4, 9:25 pm, Patrick Maywrote: > Hi, > > I have Django running under Apache with mod_wsgi. I've got a simple URL > handler that looks like this: > > def handler(request): > response = None > > if request.method == 'POST' or request.method == 'PUT': > response = HTTPResponse(status=201) > elif request.method == 'GET': > response = HttpResponse("Success") > else: > raise Http404 > > return response > > My django.wsgi looks like this: > > import os > import sys > > sys.path.append('/Users/Patrick/codestreet/src/rest') > > os.environ['DJANGO_SETTINGS_MODULE'] = 'server.settings' > > import django.core.handlers.wsgi > > application = django.core.handlers.wsgi.WSGIHandler() > > When I connect to the URL for the handler with a GET like this: > > request = urllib2.Request(self.URL) > > it works fine, returning a 200. However, when I connect with a POST like > this: > > request = urllib2.Request(self.URL,self.data) > > I get an exception thrown with a 500 code and this in the Apache error log: > > [Mon Jan 04 16:20:08 2010] [error] [client ::1] mod_wsgi (pid=48698): > Exception occurred processing WSGI script > '/Users/Patrick/codestreet/src/rest/django.wsgi'. > [Mon Jan 04 16:20:08 2010] [error] [client ::1] IOError: failed to write data > > Do I have something misconfigured? > > Thanks, > > Patrick Assuming the code you've posted is a real cut and paste, you have "HTTPResponse" for POST but "HttpResponse" for GET. Python is case- sensitive, so only "HttpResponse" will work. -- 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.
Django, Apache, mod_wsgi, GET works, POST doesn't
Hi, I have Django running under Apache with mod_wsgi. I've got a simple URL handler that looks like this: def handler(request): response = None if request.method == 'POST' or request.method == 'PUT': response = HTTPResponse(status=201) elif request.method == 'GET': response = HttpResponse("Success") else: raise Http404 return response My django.wsgi looks like this: import os import sys sys.path.append('/Users/Patrick/codestreet/src/rest') os.environ['DJANGO_SETTINGS_MODULE'] = 'server.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() When I connect to the URL for the handler with a GET like this: request = urllib2.Request(self.URL) it works fine, returning a 200. However, when I connect with a POST like this: request = urllib2.Request(self.URL,self.data) I get an exception thrown with a 500 code and this in the Apache error log: [Mon Jan 04 16:20:08 2010] [error] [client ::1] mod_wsgi (pid=48698): Exception occurred processing WSGI script '/Users/Patrick/codestreet/src/rest/django.wsgi'. [Mon Jan 04 16:20:08 2010] [error] [client ::1] IOError: failed to write data Do I have something misconfigured? Thanks, Patrick -- 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: Changing the database name by subdomain name
On Jan 4, 4:28 pm, bluellyrwrote: > Hi! > > I'm using the Django 1.0.2 and trying to connect to a diferent > database name using the subdomain by reference, > when I accesshttp://.mydomain.comI want to connect to the "" > database and when accessing to thehttp://.mydomain.comI want to connect > to the "" database. > > There is a way to do this? > > I'm trying but I can not find nothing about how to get the subdomain > from the url. > > thanks Have different vhosts for each subdomain, each using a separate settings.py file with its own database name. -- 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: Photo + thumbnail
Thank you. I have just writed this code. It works but I want to avoit to save 2 times with "super(book, self).save()" ( see below ): from django.db import models from PIL import Image import glob, os thumb_size = 90, 90 class book(models.Model): title = models.CharField(max_length=200) photo = models.ImageField(upload_to='photo_book') thumb = models.ImageField(upload_to='thumb_book', blank=True, null=True) def save(self): super(book, self).save() file_path = self.photo.url if (file_path): im = Image.open(file_path) im.thumbnail(thumb_size, Image.ANTIALIAS) root, immagin = os.path.split(file_path) immagin, ext = os.path.splitext(immagin) im.save("thumb_book/" + immagin + ".thumbnail.jpg", "JPEG") self.thumb = "thumb_book/" + immagin + ".thumbnail.jpg" super(book, self).save() On Jan 4, 5:03 pm, Justin Myerswrote: > I'm not able to test this idea directly myself at the moment, but it > appears you're storing an absolute path (i.e., starting from the > filesystem root) in self.thumb. I'm pretty sure FileFields (and, by > extension, ImageFields) store relative paths from settings.MEDIA_ROOT. > > (To make sure I'm thinking about this properly (since again, I can't > double-check this right now), you might want to see what the value of > the thumb field is in the database first. If I'm right, you should see > a path that consists of a relative path followed by an absolute one, > such as "2010/0104//home/username/webapps/media/2010/0104/ > something.thumbnail.jpg".) > > An absolute path is certainly helpful for actually operating on the > file, but before > self.thumb = imfile + ".thumbnail.jpg" > you'll need something like > imfile, ext = os.path.splitext(self.photo) # NOT .path, so this > is a relative path, not an absolute one > to make this work properly. > > Hope that helps. > -Justin > > On Jan 4, 5:15 am, nameless wrote: > > > I have writed this code but it doesn't work. What is the error ? > > > from django.db import models > > from django.forms import ModelForm > > from PIL import Image > > import glob, os > > > thumb_size = 90, 90 > > > class book(models.Model): > > title = models.CharField(max_length=200) > > photo = models.ImageField(upload_to='bookphoto') > > thumb = models.ImageField(upload_to='bookthumb') > > > def save(self): > > > file_path = self.photo.path > > if (file_path): > > imfile, ext = os.path.splitext(file_path) > > im = Image.open(file_path) > > im.thumbnail(thumb_size, Image.ANTIALIAS) > > im.save(imfile + ".thumbnail.jpg", "JPEG") > > self.thumb = imfile + ".thumbnail.jpg" > > super(book, self).save() > > > class BookForm(ModelForm): > > > class Meta: > > model = book > > exclude = ('thumb',) > > > Please help me, I am going crazy :-\ > > > -- > > > On Jan 2, 5:17 pm, Xia Kai(夏恺) wrote: > > > > Hi, > > > > This is a fantastic app, though it might be too fat for a minimalist like > > > me. ^_^ > > > > I would recommend override the default save method of the model and resize > > > the original photo using PIL. For the overriding part, you could consult > > > the > > > documentation:http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-pre... > > > > > > > Xia Kai(夏恺) > > > xia...@gmail.comhttp://blog.xiaket.org > > > > -- > > > From: "Chris Moffitt" > > > Sent: Saturday, January 02, 2010 11:59 PM > > > To: > > > Subject: Re: Photo + thumbnail > > > > > You'll probably want to use one of Django's thumbnail apps. Here's the > > > > one > > > > I > > > > recommend: > > > >http://code.google.com/p/sorl-thumbnail/* > > > > > -*Chris > > > > > On Sat, Jan 2, 2010 at 9:48 AM, nameless wrote: > > > > >> Hi everyone I have a simple question. > > > >> This is my model: > > > > >> class book(models.Model): > > > >>title = models.CharField(max_length=50) > > > >>photo = models.ImageField(upload_to='images/avatar/') > > > >>thumb = models.ImageField(upload_to='images/thumb/') > > > > >> I want in photo original photo and in thumb the same photo but > > > >> resized. > > > >> How do I do that in simplest way ? > > > > >> Thank you and Good year ^_^ -- 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: Unhelpful template traceback
I had also noticed that errors from templates were quite hard to debug. Some time ago I saw this thread on on this group: http://groups.google.com/group/django-users/browse_thread/thread/ee29c542dcc0dc95/aaa3f89a2a77fa3f?lnk=gst=template_debug#aaa3f89a2a77fa3f I applied the very simple patch, which is listed in http://code.djangoproject.com/ticket/11451 (Here's my own notes on what the patch is) File: /site-packages/django/template/debug.py # raise wrapped # remove this line, add next line, see ticket 11451 raise wrapped, None, wrapped.exc_info[2] After applying this patch I found the the traceback errors made much more sense. The tracebacks are complete now and point me to a line that is meaningful. I believe this is some sort of issue only with python 2.6, so if you are not on 2.6, it is probably not a solution for you, but if you are on 2.6, give it a try. Margie On Jan 4, 9:08 am, Thomas Steinacherwrote: > The actual error is not my point. I know that it's somewhere in a > reverse/url method, but there is no way I can test it. The point is > that there is no helpful template traceback in the deployment error e- > mails. Maybe I should direct this to django-developers instead or file > a ticket? > > On Jan 4, 6:05 pm, Victor Loureiro Lima > wrote: > > > You are probably calling {{ model.property.url }} or {{ > > model.get_absolute_url }} on some property/model (either FileField or > > ImageField in case of property) of some model of yours that doesnt know how > > to reverse back to its URL, so the template gives an error because it doesnt > > know how to render its own value. You should check if the models is correct > > and if its possible to access it thru the regex of URL. > > > Maybe if you iterate thru all objects trying to get_absolute_url them you > > could reproduce some sort of error. > > > That would be my guess =) > > > Victor Lima > > > 2010/1/4 Thomas Steinacher > > > > Hey guys, > > > > I sometimes get errors which occur rarely, so it is very difficult to > > > reproduce them in a development environment. The traceback always > > > looks similar to the traceback attached below (which is just an > > > example). > > > > My question: How can I make the Django error mails show the template > > > file name and line number where the error occurred? It is really > > > annoying as I currently see no way to debug this type of errors other > > > than guessing, which is very difficult, especially when templates are > > > very complex. > > > > Thanks, > > > > Thomas > > > > File "/home/mysite/django-mysite3/django/template/loader.py", line > > > 173, in render_to_string > > > return t.render(context_instance) > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 184, in render > > > return self._render(context) > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 178, in _render > > > return self.nodelist.render(context) > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 787, in render > > > bits.append(self.render_node(node, context)) > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 800, in render_node > > > return node.render(context) > > > > File "/home/mysite/django-mysite3/django/template/defaulttags.py", > > > line 384, in render > > > raise e > > > > NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' > > > and keyword arguments '{'username': ''}' not found. > > > > -- > > > > 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 > > groups.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: unicode encoding problem
On Mon, Jan 4, 2010 at 11:05 AM, Bill Freemanwrote: > I find the error slightly confusing because the mentioned character, \xc2, > which is capital A with circumflex, doesn't occur in the quoted part of the > text. Line 46 not included in your post, perhaps? Apparently the pound > signs, \xa3, aren't bothering it because they're in u"", or maybe it would > just complain later, or get the wrong character. > > No, it is the bytes contained in the unicode literals (u"") that trigger the error. And you have illustrated why the error is necessary by guessing (incorrectly) at the encoding in use. The byte \xc2 is not capital A with circumflex. All that can be said about the byte \xc2, in the absence of information about what encoding is in use, is that it is not an ASCII character. Saying anything more about it assumes an encoding. Saying it is capital A with circumflex assumes latin-1 encoding. In fact it appears that this file is encoded in utf-8, making \xc2 the first byte in the 2-byte sequence encoding the Unicode pound sign U+00A3 (see http://www.fileformat.info/info/unicode/char/00a3/index.htm). But I could make that guess because I could see the pound sign in the email -- the Python interpreter has no such hints to go by, all it has is the bytes contained in the file it is trying to interpret. Python needs to know the file encoding in order to correctly create a unicode object from the bytes contained in the unicode literals. It refuses to guess or assume, so you get an error if a unicode literal contains a non-ASCII byte and there is no encoding declaration in the file. > I would be tempted to avoid having non-ASCII characters in source code > by putting \xa3 where you have pound signs, but that's me. What you would need to do to avoid the error is to change the unicode literals to bytestring literals (remove the u prefix). Then the Python interpreter would not complain, because it does not need to know the encoding when building a bytestring. But then you are prone to running into trouble when the bytestring is passed to code that assumes an encoding for it that does not match the actual encoding. You might get UnicodeDecodeErrors or you might get corrupted data. Unless you are careful and really know what you are doing, taking this approach to avoid this error is not a good idea. Far better to correctly identify the file encoding via the encoding declaration and use unicode literals where appropriate. Karen -- 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.
Two HTML widgets for one DB field?
Hello all. I'm pretty new to Django, so please forgive my ignorance. What I'm wondering is if it's possible to have two HTMl widgets on the admin pages that map to the same DB field. To be specific, I have an image field for one of my DB tables. Sometimes, I might want to upload an image from my local machine (ImageField), but other times, the image might already be on the server and I'd like to input a file path (FilePathField). At the end of the day, both of these widgets save a file path to the DB. Is it possible to display both of these widgets on the admin page? Perhaps something along the lines of both displayed, but only 1 can be enabled at a time? Thanks, Jason -- 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: Generic view object_detail on a m2m relationship
This is how I did it in views.py: def businessshowservice_view(request, business_id): business = Business.objects.get(pk=business_id) services = Business.objects.get(pk=business_id).service_set.all() return object_list(request, queryset=services, extra_context={'business' : business} ) (now just have to figure out a way to get my stress back!) On Jan 4, 7:55 pm, Delacroy Systemswrote: > I see that using object_detail is the 'incorrect' generic view to show > details. I am exploring other options, including writing a custom view > to give me what I want. > > On Jan 4, 8:29 am, Delacroy Systems wrote: > > > I am trying to use the generic view, object_detail on a m2m > > relationship. I have multiple businesses that offer multiple services. > > I would like to show the services offered by each business. At the > > moment, I see all the services - not just the services that a > > particular business is offering. > > > In models.py: > > class Business(models.Model): > > business = models.CharField(max_length=100) > > > class Service(models.Model): > > service = models.CharField(max_length=100) > > providers = models.ManyToManyField(Business, through = > > "BusinessService") > > > class BusinessService(models.Model): > > business = models.ForeignKey(Business) > > service = models.ForeignKey(Service) > > > In urls.py: > > def get_service(): > > return Service.objects.all() > > > businessservice_list = { > > #'queryset' : BusinessService.objects.all(), > > 'queryset' : Business.objects.all(), > > 'extra_context': {'service_list': get_service} > > > ...skip some detail... > > (r'^showservice/(?P\d+)/$', list_detail.object_detail, > > businessservice_list), > > > In business_detail.html: > > {% block content %} > > Business Services > > {% if object %} > > {{ object.business }} > > {{ service_list }} > > {% endif %} > > {% endblock content%} > > -- 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-audiorecorder ?
On Saturday 02 January 2010 10:55:11 Waqqas Jabbar wrote: > Hi, > > There are audio players available for djagon, but is there any django > project the provide audio recording capability? > My search has not produce any good results. > > There are some python based libraries liky PyAudio ( > http://people.csail.mit.edu/hubert/pyaudio/) or Gstreamer python binding, > that can be used. Can anyone give me some ideas on how to make one of my > own ? > > I want to record only short clip.Can javascript be used for audio recording > on client computer and the upload the file? > > peace > waqqas > > -- Hi, If your purpose is to record/read live stream via a website, I think it's then better to provide either a java applet or a flash application that help the user to record audio or video via your website. For flash applications, you can use red5[1] which is an open source flash server implemented in java. It allows you to record/read live streams through flash applications (If you are brave or feisty... you could implement this server in python ;) [1] http://osflash.org/red5 If you need to implement a client in flash, you can use openlazlo[2] or use an-already-existing client. I know that the dokeos[3] project has one but I never tried to compile it or install it myself. [2] http://www.openlaszlo.org/ [3] http://dokeos.svn.sourceforge.net/viewvc/dokeos/trunk/videoconference/ Hope this helps. Fred. signature.asc Description: This is a digitally signed message part.
Re: Unhelpful template traceback
Yes, maybe thats more like the case. Victor Lima 2010/1/4 Thomas Steinacher> The actual error is not my point. I know that it's somewhere in a > reverse/url method, but there is no way I can test it. The point is > that there is no helpful template traceback in the deployment error e- > mails. Maybe I should direct this to django-developers instead or file > a ticket? > > On Jan 4, 6:05 pm, Victor Loureiro Lima > wrote: > > You are probably calling {{ model.property.url }} or {{ > > model.get_absolute_url }} on some property/model (either FileField or > > ImageField in case of property) of some model of yours that doesnt know > how > > to reverse back to its URL, so the template gives an error because it > doesnt > > know how to render its own value. You should check if the models is > correct > > and if its possible to access it thru the regex of URL. > > > > Maybe if you iterate thru all objects trying to get_absolute_url them > you > > could reproduce some sort of error. > > > > That would be my guess =) > > > > Victor Lima > > > > 2010/1/4 Thomas Steinacher > > > > > > > > > Hey guys, > > > > > I sometimes get errors which occur rarely, so it is very difficult to > > > reproduce them in a development environment. The traceback always > > > looks similar to the traceback attached below (which is just an > > > example). > > > > > My question: How can I make the Django error mails show the template > > > file name and line number where the error occurred? It is really > > > annoying as I currently see no way to debug this type of errors other > > > than guessing, which is very difficult, especially when templates are > > > very complex. > > > > > Thanks, > > > > > Thomas > > > > > File "/home/mysite/django-mysite3/django/template/loader.py", line > > > 173, in render_to_string > > > return t.render(context_instance) > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 184, in render > > > return self._render(context) > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 178, in _render > > > return self.nodelist.render(context) > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 787, in render > > > bits.append(self.render_node(node, context)) > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 800, in render_node > > > return node.render(context) > > > > > File "/home/mysite/django-mysite3/django/template/defaulttags.py", > > > line 384, in render > > > raise e > > > > > NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' > > > and keyword arguments '{'username': ''}' not found. > > > > > -- > > > > > 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. > > > -- 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: Generic view object_detail on a m2m relationship
I see that using object_detail is the 'incorrect' generic view to show details. I am exploring other options, including writing a custom view to give me what I want. On Jan 4, 8:29 am, Delacroy Systemswrote: > I am trying to use the generic view, object_detail on a m2m > relationship. I have multiple businesses that offer multiple services. > I would like to show the services offered by each business. At the > moment, I see all the services - not just the services that a > particular business is offering. > > In models.py: > class Business(models.Model): > business = models.CharField(max_length=100) > > class Service(models.Model): > service = models.CharField(max_length=100) > providers = models.ManyToManyField(Business, through = > "BusinessService") > > class BusinessService(models.Model): > business = models.ForeignKey(Business) > service = models.ForeignKey(Service) > > In urls.py: > def get_service(): > return Service.objects.all() > > businessservice_list = { > #'queryset' : BusinessService.objects.all(), > 'queryset' : Business.objects.all(), > 'extra_context': {'service_list': get_service} > > ...skip some detail... > (r'^showservice/(?P\d+)/$', list_detail.object_detail, > businessservice_list), > > In business_detail.html: > {% block content %} > Business Services > {% if object %} > {{ object.business }} > {{ service_list }} > {% endif %} > {% endblock content%} -- 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: Unhelpful template traceback
The actual error is not my point. I know that it's somewhere in a reverse/url method, but there is no way I can test it. The point is that there is no helpful template traceback in the deployment error e- mails. Maybe I should direct this to django-developers instead or file a ticket? On Jan 4, 6:05 pm, Victor Loureiro Limawrote: > You are probably calling {{ model.property.url }} or {{ > model.get_absolute_url }} on some property/model (either FileField or > ImageField in case of property) of some model of yours that doesnt know how > to reverse back to its URL, so the template gives an error because it doesnt > know how to render its own value. You should check if the models is correct > and if its possible to access it thru the regex of URL. > > Maybe if you iterate thru all objects trying to get_absolute_url them you > could reproduce some sort of error. > > That would be my guess =) > > Victor Lima > > 2010/1/4 Thomas Steinacher > > > > > Hey guys, > > > I sometimes get errors which occur rarely, so it is very difficult to > > reproduce them in a development environment. The traceback always > > looks similar to the traceback attached below (which is just an > > example). > > > My question: How can I make the Django error mails show the template > > file name and line number where the error occurred? It is really > > annoying as I currently see no way to debug this type of errors other > > than guessing, which is very difficult, especially when templates are > > very complex. > > > Thanks, > > > Thomas > > > File "/home/mysite/django-mysite3/django/template/loader.py", line > > 173, in render_to_string > > return t.render(context_instance) > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > 184, in render > > return self._render(context) > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > 178, in _render > > return self.nodelist.render(context) > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > 787, in render > > bits.append(self.render_node(node, context)) > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > 800, in render_node > > return node.render(context) > > > File "/home/mysite/django-mysite3/django/template/defaulttags.py", > > line 384, in render > > raise e > > > NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' > > and keyword arguments '{'username': ''}' not found. > > > -- > > > 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 > groups.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: Unhelpful template traceback
You are probably calling {{ model.property.url }} or {{ model.get_absolute_url }} on some property/model (either FileField or ImageField in case of property) of some model of yours that doesnt know how to reverse back to its URL, so the template gives an error because it doesnt know how to render its own value. You should check if the models is correct and if its possible to access it thru the regex of URL. Maybe if you iterate thru all objects trying to get_absolute_url them you could reproduce some sort of error. That would be my guess =) Victor Lima 2010/1/4 Thomas Steinacher> Hey guys, > > I sometimes get errors which occur rarely, so it is very difficult to > reproduce them in a development environment. The traceback always > looks similar to the traceback attached below (which is just an > example). > > My question: How can I make the Django error mails show the template > file name and line number where the error occurred? It is really > annoying as I currently see no way to debug this type of errors other > than guessing, which is very difficult, especially when templates are > very complex. > > Thanks, > > Thomas > > > > File "/home/mysite/django-mysite3/django/template/loader.py", line > 173, in render_to_string > return t.render(context_instance) > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > 184, in render > return self._render(context) > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > 178, in _render > return self.nodelist.render(context) > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > 787, in render > bits.append(self.render_node(node, context)) > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > 800, in render_node > return node.render(context) > > File "/home/mysite/django-mysite3/django/template/defaulttags.py", > line 384, in render > raise e > > NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' > and keyword arguments '{'username': ''}' not found. > > -- > > 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: Changing the database name by subdomain name
It seems like you should have two instances of Django running. Each one will be listening on a different port, and run a different settings.py file. In short, copy your settings.py file, and change the copy to use the alternate database. Then, run two copies of Django, like this (may vary based on how your server is set up): ./manage.py runfcgi host=127.0.0.1 port=8100 --settings=myproject.settings ./manage.py runfcgi host=127.0.0.1 port=8200 --settings=myproject._settings Of course, your Web server (Apache, nginx, whatever) needs to have another entry added for the new port number and url. Shawn -- 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 Gantt Chart
what about: http://matplotlib.sourceforge.net/ -- Hinnack 2010/1/4 Daniel Hilton> 2010/1/4 Alessandro Ronchi : > > I need to make a simple chart with a list of projects and a grafic > > display of the end date with a link to the project page. > > It's simpler than a gantt chart. > > > > Is there any library / snippet I can use to simplify my work? > > > > Hmmm, as I'm about to do something similar I've also researched this. > > If you're just looking at displaying a list of objects(projects) then > you can use a generic view and then handle the display in the > template, which means the following links may be of help: > > http://www.jlion.com/docs/gantt.aspx > http://www.jsgantt.com/ > > Niether of which are particularly pretty but the basics are there > ready to be reskinned. > > http://www.ext-scheduler.com/examples.html > > Is however, pretty awesome, if commercially licensed. > > This question on stackoverflow is pretty extensive as well: > http://stackoverflow.com/questions/1005587/gantt-chart-online > > If I don't find one I like, I'm thinking about writing a template tag > and some jQuery to make a nice dependency graph. > HTH, > Dan > > > > > > -- > > Alessandro Ronchi > > > > http://www.soasi.com > > SOASI - Sviluppo Software e Sistemi Open Source > > > > http://hobbygiochi.com > > Hobby & Giochi, l'e-commerce del divertimento > > > > -- > > > > 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. > > > > > > > > > > -- > Dan Hilton > > www.twitter.com/danhilton > www.DanHilton.co.uk > > > -- > > 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.
Unhelpful template traceback
Hey guys, I sometimes get errors which occur rarely, so it is very difficult to reproduce them in a development environment. The traceback always looks similar to the traceback attached below (which is just an example). My question: How can I make the Django error mails show the template file name and line number where the error occurred? It is really annoying as I currently see no way to debug this type of errors other than guessing, which is very difficult, especially when templates are very complex. Thanks, Thomas File "/home/mysite/django-mysite3/django/template/loader.py", line 173, in render_to_string return t.render(context_instance) File "/home/mysite/django-mysite3/django/template/__init__.py", line 184, in render return self._render(context) File "/home/mysite/django-mysite3/django/template/__init__.py", line 178, in _render return self.nodelist.render(context) File "/home/mysite/django-mysite3/django/template/__init__.py", line 787, in render bits.append(self.render_node(node, context)) File "/home/mysite/django-mysite3/django/template/__init__.py", line 800, in render_node return node.render(context) File "/home/mysite/django-mysite3/django/template/defaulttags.py", line 384, in render raise e NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' and keyword arguments '{'username': ''}' not found. -- 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.
Changing the database name by subdomain name
Hi! I'm using the Django 1.0.2 and trying to connect to a diferent database name using the subdomain by reference, when I access http://.mydomain.com I want to connect to the "" database and when accessing to the http://.mydomain.com I want to connect to the "" database. There is a way to do this? I'm trying but I can not find nothing about how to get the subdomain from the url. 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: unicode encoding problem
Hi Bill, Simon, On 04/01/10 16:05, Bill Freeman wrote: > I find the error slightly confusing because the mentioned character, > \xc2, which is capital A with circumflex, doesn't occur in the quoted > part of the text. \xc2 is the first byte of a character encoded in UTF-8 as two bytes. The character you were expecting is U+00C2, being a Unicode codepoint (as opposed to an encoding thereof). For what it's worth, my experience of the method given in the PEP has been positive. Regards, Alex PS. Sorry for the multiple copies, Bill. The Reply-list button in TB3 is (still) broken -- 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: unicode encoding problem
I find the error slightly confusing because the mentioned character, \xc2, which is capital A with circumflex, doesn't occur in the quoted part of the text. Line 46 not included in your post, perhaps? Apparently the pound signs, \xa3, aren't bothering it because they're in u"", or maybe it would just complain later, or get the wrong character. I would be tempted to avoid having non-ASCII characters in source code by putting \xa3 where you have pound signs, but that's me. Karen's suggestion that an answer is in the PEP mentioned by the error message is correct, but may be more subtle than you're prepared for at the moment. I'm assuming that your editor is using Latin-1, so both the pound signs and the A with circumflex would be correctly interpreted. However, even if you specify an encoding for strings, and a default encoding for files, I think that you will eventually have trouble with using non-ASCII for non-string purposes (class or method name, variable or attribute names). Bill On Sun, Jan 3, 2010 at 6:48 PM, Simon Davieswrote: > I know I'm missing something really simple really but I keep getting > this error: > > SyntaxError: Non-ASCII character '\xc2' in file /home/simon/ > djangoprojects/bikerescue/bikeshop/models.py on line 46, but no > encoding declared; see http://www.python.org/peps/pep-0263.html for > details. This is the model in question and I have the __unicode__ > function in there > > class Item(models.Model): > title = models.CharField(max_length=100) > description = models.CharField(max_length=500) > price = models.FloatField(max_length=10, verbose_name=u'Price (£)') > > def __unicode__(self): > return self.title > > def _get_disp_price(self): > return u"£" + self.price > > disp_price = property(_get_disp_price) > > I 've put the unicode u in both places where its required so why is it > still tripping up. > > Many thanks > > Simon > > -- > > 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: Photo + thumbnail
I'm not able to test this idea directly myself at the moment, but it appears you're storing an absolute path (i.e., starting from the filesystem root) in self.thumb. I'm pretty sure FileFields (and, by extension, ImageFields) store relative paths from settings.MEDIA_ROOT. (To make sure I'm thinking about this properly (since again, I can't double-check this right now), you might want to see what the value of the thumb field is in the database first. If I'm right, you should see a path that consists of a relative path followed by an absolute one, such as "2010/0104//home/username/webapps/media/2010/0104/ something.thumbnail.jpg".) An absolute path is certainly helpful for actually operating on the file, but before self.thumb = imfile + ".thumbnail.jpg" you'll need something like imfile, ext = os.path.splitext(self.photo) # NOT .path, so this is a relative path, not an absolute one to make this work properly. Hope that helps. -Justin On Jan 4, 5:15 am, namelesswrote: > I have writed this code but it doesn't work. What is the error ? > > from django.db import models > from django.forms import ModelForm > from PIL import Image > import glob, os > > thumb_size = 90, 90 > > class book(models.Model): > title = models.CharField(max_length=200) > photo = models.ImageField(upload_to='bookphoto') > thumb = models.ImageField(upload_to='bookthumb') > > def save(self): > > file_path = self.photo.path > if (file_path): > imfile, ext = os.path.splitext(file_path) > im = Image.open(file_path) > im.thumbnail(thumb_size, Image.ANTIALIAS) > im.save(imfile + ".thumbnail.jpg", "JPEG") > self.thumb = imfile + ".thumbnail.jpg" > super(book, self).save() > > class BookForm(ModelForm): > > class Meta: > model = book > exclude = ('thumb',) > > Please help me, I am going crazy :-\ > > -- > > On Jan 2, 5:17 pm, Xia Kai(夏恺) wrote: > > > Hi, > > > This is a fantastic app, though it might be too fat for a minimalist like > > me. ^_^ > > > I would recommend override the default save method of the model and resize > > the original photo using PIL. For the overriding part, you could consult the > > documentation:http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-pre... > > > > > Xia Kai(夏恺) > > xia...@gmail.comhttp://blog.xiaket.org > > > -- > > From: "Chris Moffitt" > > Sent: Saturday, January 02, 2010 11:59 PM > > To: > > Subject: Re: Photo + thumbnail > > > > You'll probably want to use one of Django's thumbnail apps. Here's the one > > > I > > > recommend: > > >http://code.google.com/p/sorl-thumbnail/* > > > > -*Chris > > > > On Sat, Jan 2, 2010 at 9:48 AM, nameless wrote: > > > >> Hi everyone I have a simple question. > > >> This is my model: > > > >> class book(models.Model): > > >>title = models.CharField(max_length=50) > > >>photo = models.ImageField(upload_to='images/avatar/') > > >>thumb = models.ImageField(upload_to='images/thumb/') > > > >> I want in photo original photo and in thumb the same photo but > > >> resized. > > >> How do I do that in simplest way ? > > > >> Thank you and Good year ^_^ -- 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: Passing a parameter into a queryset for a generic view
There may be an easier way, but I'd write a view, even if I then called the generic view from there. As you've probably figured out, your definition of the queryset occurs once at import, when object_id isn't even defined, let alone coming from each request in turn. Bill On Sun, Jan 3, 2010 at 4:15 PM, Delacroy Systemswrote: > I want to display all the services for a particular business using the > generic view "object_detail". What I would like to do is pass the > value of an id from the url to the queryset (into object_id) in > urls.py - or a better way to do this using the "object_detail" generic > view. > > models.py: > class BusinessService(models.Model): > business = models.ForeignKey(Business) > service = models.ForeignKey(Service) > > urls.py: > businessservice_list = { > 'queryset' : BusinessService.objects.filter( > business=object_id), > } > ...skip some detail... > (r'^showservice/(?P\d+)/$', list_detail.object_detail, > businessservice_list), > > businessservice_detail.html: > {% extends "portal/base.html" %} > {% block pagename %}Business Services{% endblock pagename %} > {% block content %} > Business Services > {{ businessservice.business }} > > {% for business in object_list %} > {{ businessservice.service }} > {% endfor %} > > {% endblock content%} > > -- > > 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: Session cache backend or cache API failure
Hello, I've the same problem there.. Did you find out any solution? Or at least the source of the problem? Regards, Ales -- Ales Zoulek Jabber: ales.zou...@gmail.com -- On Sat, Oct 3, 2009 at 3:24 AM, Calvin Spealmanwrote: > > I've spent all day diagnosing this with no success. I would get random > errors in logs with the traceback below, showing a failure to create a > new session. Memcache logs show all 1 tries succeeding (I have > also confirmed the empty sessions are still held in cache after). From > what I can see, session.backends.cache tries 10,000 keys that are all > successful, but it thinks they fail and ignores the success. This only > happens in about 1% of requests. > > <31 add 980bdad78f56a4d24e0eebf43625918a 1 1209600 6 > > NOT FOUND 980bdad78f56a4d24e0eebf43625918a > >31 STORED > <31 get a0948fa9c0add4b803ba85d5939b5a2c > > NOT FOUND a0948fa9c0add4b803ba85d5939b5a2c > >31 END > <31 get a0948fa9c0add4b803ba85d5939b5a2c > > NOT FOUND a0948fa9c0add4b803ba85d5939b5a2c > >31 END > <31 add a0948fa9c0add4b803ba85d5939b5a2c 1 1209600 6 > > NOT FOUND a0948fa9c0add4b803ba85d5939b5a2c > >31 STORED > <31 get 74b1dcca57f28779305180995d362136 > > NOT FOUND 74b1dcca57f28779305180995d362136 > >31 END > <31 get 74b1dcca57f28779305180995d362136 > > NOT FOUND 74b1dcca57f28779305180995d362136 > >31 END > <31 add 74b1dcca57f28779305180995d362136 1 1209600 6 > > NOT FOUND 74b1dcca57f28779305180995d362136 > >31 STORED > <31 connection closed. > > File "/opt/faircompanies/env/lib/python2.5/site-packages/ > flup-1.0.3.dev_20090612-py2.5.egg/flup/server/fcgi_base.py", line 558, > in run >protocolStatus, appStatus = self.server.handler(self) > File "/opt/faircompanies/env/lib/python2.5/site-packages/ > flup-1.0.3.dev_20090612-py2.5.egg/flup/server/fcgi_base.py", line > 1118, in handler >result = self.application(environ, start_response) > File "/opt/faircompanies/env/lib/python2.5/django/core/handlers/ > wsgi.py", line 239, in __call__ >response = self.get_response(request) > File "/opt/faircompanies/env/lib/python2.5/django/core/handlers/ > base.py", line 67, in get_response >response = middleware_method(request) > File "/opt/faircompanies/fc/django_authopenid/middleware.py", line > 11, in process_request >request.openid = request.session.get('openid', None) > File "/opt/faircompanies/env/lib/python2.5/django/contrib/sessions/ > backends/base.py", line 63, in get >return self._session.get(key, default) > File "/opt/faircompanies/env/lib/python2.5/django/contrib/sessions/ > backends/base.py", line 172, in _get_session >self._session_cache = self.load() > File "/opt/faircompanies/env/lib/python2.5/django/contrib/sessions/ > backends/cache.py", line 16, in load >self.create() > File "/opt/faircompanies/env/lib/python2.5/django/contrib/sessions/ > backends/cache.py", line 33, in create >raise RuntimeError("Unable to create a new session key.") > RuntimeError: Unable to create a new session key > > --~--~-~--~~~---~--~~ > 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 > 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: Beta testers for a syntax highlighting widget
I've downloaded and may try the widget. But, unless I'm mistaking the example you show on your page: 1. You're not going to pry me away from emacs for editing python, or css, or html, or javascript. I'm sure that others have their favorite editors as well. 2. Even if you could provide the perfect emacs-like experience, I'm not going to edit code through the web. I edit files locally, check them in to mercurial, push them to our server, ssh to the web server and pull the changes there. Were you intending to add revision control check in and authentication? Even if I'm forced to use someone else's computer, I can either ssh into the webserver to work securely on the files, or I demur. 3. So it seems the remaining usage is what TinyMCE, et al, get used for: Allowing users to create page content. (I'm sure not going to let them code views or templates.) The few of them that want to edit in html mode could well benefit from syntax highlighting, auto indent, etc. But they probably want to switch back and forth between code view and how it looks view, as people to with kupu, TinyMCE, etc., and they still will want to be able to edit in how it looks mode. So it seems to me that what's really called for is an extension to html mode of some existing editor widget. Bill On Sun, Jan 3, 2010 at 11:07 AM, adityawrote: > Anyone? Limited testing will do, I just want to make sure I haven't > overlooked something. > > -- > > 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: django-audiorecorder ?
Boy, I sure hope that you can't record audio at my house just be virtue of my having visited a web page. You might be able to offer a Java app (hopefully not applet) that the user can install and run (the user may not have python), producing a file that they can then upload to you. Or even record directly to you if they give the script net access permission. Of course you have to configure their mixer as well, possibly guessing which input has the source you want. You could mess things up for the naive. (People who install and run stuff they've downloaded from a random website deserve what they get.) But so long as it's a short clip, even MS sound recorder will do, and I assume that MACs have something like that. Most linux's too, have (at least one) suitable tool. So if it were me, I'd simple provide instructions as to how to create a file to upload. Bill On Sat, Jan 2, 2010 at 4:55 AM, Waqqas Jabbarwrote: > Hi, > > There are audio players available for djagon, but is there any django > project the provide audio recording capability? > My search has not produce any good results. > > There are some python based libraries liky PyAudio > (http://people.csail.mit.edu/hubert/pyaudio/) or Gstreamer python binding, > that can be used. Can anyone give me some ideas on how to make one of my own > ? > > I want to record only short clip.Can javascript be used for audio recording > on client computer and the upload the file? > > peace > waqqas > > > -- > > 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: Django Gantt Chart
2010/1/4 Alessandro Ronchi: > I need to make a simple chart with a list of projects and a grafic > display of the end date with a link to the project page. > It's simpler than a gantt chart. > > Is there any library / snippet I can use to simplify my work? > Hmmm, as I'm about to do something similar I've also researched this. If you're just looking at displaying a list of objects(projects) then you can use a generic view and then handle the display in the template, which means the following links may be of help: http://www.jlion.com/docs/gantt.aspx http://www.jsgantt.com/ Niether of which are particularly pretty but the basics are there ready to be reskinned. http://www.ext-scheduler.com/examples.html Is however, pretty awesome, if commercially licensed. This question on stackoverflow is pretty extensive as well: http://stackoverflow.com/questions/1005587/gantt-chart-online If I don't find one I like, I'm thinking about writing a template tag and some jQuery to make a nice dependency graph. HTH, Dan > -- > Alessandro Ronchi > > http://www.soasi.com > SOASI - Sviluppo Software e Sistemi Open Source > > http://hobbygiochi.com > Hobby & Giochi, l'e-commerce del divertimento > > -- > > 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. > > > -- Dan Hilton www.twitter.com/danhilton www.DanHilton.co.uk -- 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 about json
Here you go: http://catb.org/~esr/faqs/smart-questions.html -- 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 about json
hi,all happy new year! im my template i have some field ,but i hope that users can customerize the form (for example, they can add some more other fields,)i know it use json ,but i need some source or link, anyone can help 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.
Django Gantt Chart
I need to make a simple chart with a list of projects and a grafic display of the end date with a link to the project page. It's simpler than a gantt chart. Is there any library / snippet I can use to simplify my work? -- Alessandro Ronchi http://www.soasi.com SOASI - Sviluppo Software e Sistemi Open Source http://hobbygiochi.com Hobby & Giochi, l'e-commerce del divertimento -- 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.
Backwards incompatible change to Email Backends in Django Trunk
Hi all, If you have been using the new email backend feature in trunk, you should be aware that SVN revision 12084 introduces a small, but backwards-incompatible change. If you are using Django 1.1 (i.e., Django stable), or you haven't manually specified EMAIL_BACKEND in your settings file, you will not be affected by this change. This change only affects users who are using a recent Django Trunk checkout, AND have manually specified EMAIL_BACKEND in their settings file. These users will need to make a small configuration change. When the email backend feature was committed in revision 11709, the EMAIL_BACKEND setting was specified at the level of a module. That is, if you were using the file-based backend, you would have specified: EMAIL_BACKEND = 'django.core.mail.backends.filebased' As of revision 12084, this has been modified to be a class-level specification. You must now specify: EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend' Rather than specifying the module that contains the email backend class, you need to specify the full name of the backend class. This means you need to append ".EmailBackend" to any existing EMAIL_BACKEND setting. This has been done to normalize the way that pluggable backends are defined in Django. At the time that the email backend was committed, no formal policy had been set regarding conventions for specifying backends. A policy emerged as a result of the introduction of session-based messages. Since email backends have not yet been part of a formal Django release, we have decided to make this change to maintain consistency between the backends that will be introduced in v1.2. Apologies for any inconvenience this causes to those of you on the bleeding edge. Yours, Russ Magee %-) -- 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: debugging cache
On Dec 24, 2009, at 10:28 PM, brook wrote: > > > On Dec 23, 5:13 am, Eric Abrahamsenwrote: >> >> I'm using memcached with the cache_page decorator, and it simply >> wasn't caching >> views. > >> CACHE_MIDDLEWARE_KEY_PREFIX = 'blah' >> CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True >> CACHE_BACKEND = 'memcached://XX.XX.XX.XXX:6905/' >> >> I have no cache-related middlewares installed. >> > > If you are using the "per-view" caching technique (using the > cache_page decorator), and you haven't got caching middleware enabled, > then CACHE_MIDDLEWARE_PREFIX and CACHE_MIDDLEWARE_ANONYMOUS_ONLY won't > do anything. These are related to "per-site" caching, as detailed in > the documentation: > http://docs.djangoproject.com/en/1.1/topics/cache/#the-per-site-cache > > You might consider using database caching[1] in your development > environment, to make inspecting the cache easier. You can then look at > the caching table in your database to check whether it is being > populated as expected. That way you can start to narrow down where the > problem lies (django's caching, or memcached). Thanks for the tip! The database is being populated as expected by the cache framework, so the problem must lie with memcached somehow. Could there be some permissions issues going on here? Some conflict between the apache user and my user, which started memcached? Any hints appreciated, in the meantime I'll continue poking. E > > [1] http://docs.djangoproject.com/en/1.1/topics/cache/#database- > caching > > -- > > 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: Cannot reach development server in a rackspace cloud server
Ehi Marc, thank you very much. By doing a nmap scan I noticed the port 8000 is filtered. so I tryed flushing iptables and it worked...now i've just to set up again filtering over other ports. Thank you again, Simone. On Jan 4, 12:27 pm, Marc Aymerichwrote: > On Mon, Jan 4, 2010 at 12:04 PM, simonecare...@gmail.com < > > > > > > simonecare...@gmail.com> wrote: > > > python2.5 manage.py runserver 0.0.0.0:8000, but i can't point my web > > > browser to that address. > > > Of course I mean MY.IP.ADDRESS:8000. :) > > > On Jan 4, 12:01 pm, "simonecare...@gmail.com" > > wrote: > > > Hi everyone, > > > > i've just setted up a new Centos 5.4 based cloud server at Rackspace. > > > Installed Python2.5 and virtualenv, devel-tools, and all went ok but I > > > can't reach the development server. > > > > I started a new django project, then launched > > > > python2.5 manage.py runserver 0.0.0.0:8000, but i can't point my web > > > browser to that address. > > > > Any ideas? > > take a look with: netstat -ltnp|grep python > can you ping YOUR.IP.ADDRESS ?? > what say nmap YOU.IP.ADDRESS -p 8000 (client side) ? > check your /etc/hosts (client side) > check your /etc/hosts.deny (server and client side) > maybe something with iptables: iptables -F > in server side.. can you connect with: links2http://localhost:8000 ? > Maybe Firewalls on the way? > > > > > > Also tried to disable SELinux, but nothing changed. > > > > Thanks, > > > Simone. > > > -- > > > 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 > groups.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: Cannot reach development server in a rackspace cloud server
On Mon, Jan 4, 2010 at 12:04 PM, simonecare...@gmail.com < simonecare...@gmail.com> wrote: > > python2.5 manage.py runserver 0.0.0.0:8000, but i can't point my web > > browser to that address. > > Of course I mean MY.IP.ADDRESS:8000. :) > > > > On Jan 4, 12:01 pm, "simonecare...@gmail.com" >wrote: > > Hi everyone, > > > > i've just setted up a new Centos 5.4 based cloud server at Rackspace. > > Installed Python2.5 and virtualenv, devel-tools, and all went ok but I > > can't reach the development server. > > > > I started a new django project, then launched > > > > python2.5 manage.py runserver 0.0.0.0:8000, but i can't point my web > > browser to that address. > > > > Any ideas? > > > take a look with: netstat -ltnp|grep python can you ping YOUR.IP.ADDRESS ?? what say nmap YOU.IP.ADDRESS -p 8000 (client side) ? check your /etc/hosts (client side) check your /etc/hosts.deny (server and client side) maybe something with iptables: iptables -F in server side.. can you connect with: links2 http://localhost:8000 ? Maybe Firewalls on the way? > > Also tried to disable SELinux, but nothing changed. > > > > Thanks, > > Simone. > > -- > > 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: Photo + thumbnail
I have writed this code but it doesn't work. What is the error ? from django.db import models from django.forms import ModelForm from PIL import Image import glob, os thumb_size = 90, 90 class book(models.Model): title = models.CharField(max_length=200) photo = models.ImageField(upload_to='bookphoto') thumb = models.ImageField(upload_to='bookthumb') def save(self): file_path = self.photo.path if (file_path): imfile, ext = os.path.splitext(file_path) im = Image.open(file_path) im.thumbnail(thumb_size, Image.ANTIALIAS) im.save(imfile + ".thumbnail.jpg", "JPEG") self.thumb = imfile + ".thumbnail.jpg" super(book, self).save() class BookForm(ModelForm): class Meta: model = book exclude = ('thumb',) Please help me, I am going crazy :-\ -- On Jan 2, 5:17 pm, Xia Kai(夏恺)wrote: > Hi, > > This is a fantastic app, though it might be too fat for a minimalist like > me. ^_^ > > I would recommend override the default save method of the model and resize > the original photo using PIL. For the overriding part, you could consult the > documentation:http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-pre... > > > Xia Kai(夏恺) > xia...@gmail.comhttp://blog.xiaket.org > > -- > From: "Chris Moffitt" > Sent: Saturday, January 02, 2010 11:59 PM > To: > Subject: Re: Photo + thumbnail > > > You'll probably want to use one of Django's thumbnail apps. Here's the one > > I > > recommend: > >http://code.google.com/p/sorl-thumbnail/* > > > -*Chris > > > On Sat, Jan 2, 2010 at 9:48 AM, nameless wrote: > > >> Hi everyone I have a simple question. > >> This is my model: > > >> class book(models.Model): > >>title = models.CharField(max_length=50) > >>photo = models.ImageField(upload_to='images/avatar/') > >>thumb = models.ImageField(upload_to='images/thumb/') > > >> I want in photo original photo and in thumb the same photo but > >> resized. > >> How do I do that in simplest way ? > > >> Thank you and Good year ^_^ -- 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: Photo + thumbnail
I have writed this code but it doesn't work. What is the error ? from django.db import models from django.forms import ModelForm from PIL import Image import glob, os thumb_size = 90, 90 class book(models.Model): title = models.CharField(max_length=200) photo = models.ImageField(upload_to='bookphoto') thumb = models.ImageField(upload_to='bookthumb') def save(self): file_path = self.photo.path if (file_path): imfile, ext = os.path.splitext(file_path) im = Image.open(file_path) im.thumbnail(thumb_size, Image.ANTIALIAS) im.save(immagin + ".thumbnail.jpg", "JPEG") self.thumb = imfile + ".thumbnail.jpg" super(book, self).save() class BookForm(ModelForm): class Meta: model = book exclude = ('thumb',) Please help me, I am going crazy :-\ -- On Jan 2, 5:17 pm, Xia Kai(夏恺)wrote: > Hi, > > This is a fantastic app, though it might be too fat for a minimalist like > me. ^_^ > > I would recommend override the default save method of the model and resize > the original photo using PIL. For the overriding part, you could consult the > documentation:http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-pre... > > > Xia Kai(夏恺) > xia...@gmail.comhttp://blog.xiaket.org > > -- > From: "Chris Moffitt" > Sent: Saturday, January 02, 2010 11:59 PM > To: > Subject: Re: Photo + thumbnail > > > You'll probably want to use one of Django's thumbnail apps. Here's the one > > I > > recommend: > >http://code.google.com/p/sorl-thumbnail/* > > > -*Chris > > > On Sat, Jan 2, 2010 at 9:48 AM, nameless wrote: > > >> Hi everyone I have a simple question. > >> This is my model: > > >> class book(models.Model): > >> title = models.CharField(max_length=50) > >> photo = models.ImageField(upload_to='images/avatar/') > >> thumb = models.ImageField(upload_to='images/thumb/') > > >> I want in photo original photo and in thumb the same photo but > >> resized. > >> How do I do that in simplest way ? > > >> Thank you and Good year ^_^ -- 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 reach development server in a rackspace cloud server
> python2.5 manage.py runserver 0.0.0.0:8000, but i can't point my web > browser to that address. Of course I mean MY.IP.ADDRESS:8000. :) On Jan 4, 12:01 pm, "simonecare...@gmail.com"wrote: > Hi everyone, > > i've just setted up a new Centos 5.4 based cloud server at Rackspace. > Installed Python2.5 and virtualenv, devel-tools, and all went ok but I > can't reach the development server. > > I started a new django project, then launched > > python2.5 manage.py runserver 0.0.0.0:8000, but i can't point my web > browser to that address. > > Any ideas? > > Also tried to disable SELinux, but nothing changed. > > Thanks, > Simone. -- 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 reach development server in a rackspace cloud server
Hi everyone, i've just setted up a new Centos 5.4 based cloud server at Rackspace. Installed Python2.5 and virtualenv, devel-tools, and all went ok but I can't reach the development server. I started a new django project, then launched python2.5 manage.py runserver 0.0.0.0:8000, but i can't point my web browser to that address. Any ideas? Also tried to disable SELinux, but nothing changed. Thanks, Simone. -- 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: reverse drops the project from the url returned
Another way that people can screw up SCRIPT_NAME determination in a server is not to use WSGIScriptAlias, but use WSGIScriptAliasMatch and not use it properly. So, please post the actual Apache configuration snippet you are using to map you Django application with mod_wsgi so can verify that the configuration you are using is in fact correct. Normally WebFaction recipes should create it correctly, but if you have hand crafted it and followed one of the incorrect blog posts out there about it, you could have problems. Graham On Jan 4, 6:23 pm, Graham Dumpletonwrote: > On Jan 4, 12:45 pm, davathar wrote: > > > > > > > Here's more information I've been able to find. Evidently there's a > > problem in some configurations wheremod_wsgieither isn't receiving > > or isn't passing SCRIPT_NAME. > > > When I use this test script in the wsgi file I get an empty string as > > the value for SCRIPT_NAME. And from what I gather that's where / > > helpdesk should be so it can be passed to django so it's aware of the > > full path. > > > ** > > import cStringIO > > > def application(environ, start_response): > > headers = [] > > headers.append(('Content-Type', 'text/plain')) > > write = start_response('200 OK', headers) > > > input = environ['wsgi.input'] > > output = cStringIO.StringIO() > > > keys = environ.keys() > > keys.sort() > > for key in keys: > > print >> output, '%s: %s' % (key, repr(environ[key])) > > print >> output > > > output.write(input.read(int(environ.get('CONTENT_LENGTH', '0' > > > return [output.getvalue()] > > * > > > So it may not be as much a django issue as an apache/wsgi one. I'm > > not skilled enough to make that distinction though. For now I'm just > > going to serve the app from the root and move it when I learn more or > > the issue is fixed. > > > I tested the admin module and I get the same problem. Wherever the / > > helpdesk is present in the URL everything serves properly. But when I > > post a form, it's dropped from the path and I get "There is no > > application mounted at the root of this domain. " because I have > > nothing mounted at the root. I assume that message is served by > > apache. > > > My host Webfaction uses multiple apache applications where the first > > one is shared for the server. I don't get direct access to the > > settings for this. Only control panel access which may make some > > changes indirectly. I think it uses settings or maybe > > SymLinks? to forward the request to another instance of apache that is > > installed with Django on my share of the server. I have total control > > of that apache. So, perhaps the first apache isn't passing any value > > to the second one to indicate the first "mount point" is present. > > This would be the "SCRIPT_NAME" from what I gather. > > Unless you are on an old server build, WebFaction uses nginx as front > end, not Apache. > > In either case, the front end mount point isn't passed across. For it > all to work properly, the front end mount point must match the backend > mount point. You cannot mount on front end as /helpdesk and then have > it proxy to / on backend for example. The backend must be mounted at / > helpdesk as well. > > In respect of prior discussion, did you disable mod_rewrite in backend > Apache? > > Graham > > > > > Yet another manifestation of the issue can be found by leaving off the > > trailing slash at the end of the url : example.com/helpdesk/support/ > > case/1 will automatically redirect to example.com/support/case/1/ as > > django adds the slash but drops the /helpdesk > > > ...com/helpdesk results in "There is no application mounted at the > > root of this domain. " > > > com/helpdesk/ renders the app since my root urls.py contains "(r'^ > > $', 'helpdesk.support.views.home')," to call the support app home > > view. > > > I hope some of this information helps. In the mean time all the work > > I've had to do to "move" my code to the root has completely convinced > > me of the wisdom of decoupling. ;-) And at the same time the reason > > I'm even having the trouble is because of the use of functions like > > reverse to avoid hard coding views and templates to urls! > > > Thanks for your feedback. > > > On Jan 3, 5:50 pm, Karen Tracey wrote: > > > > On Sun, Jan 3, 2010 at 5:15 PM, davathar wrote: > > > > Ramiro, thanks for the links. That other thread does seem to describe > > > > the same problem and results in it being identified as a bug in the > > > > core urlresolvers. Unfortunately the work around of "RewriteRule ^/ > > > > studio$ /studio/ [R] " doesn't work for me for some reason. Maybe I'm > > > > misapplying it. > > > > > Either way. I'm going to drop this for now and see what happens with > > > > the ticket that was opened. It seems like this would be a very big > > > > issue if
Re: jquery, keyup event on a text input
I found the problem...thread closed On Jan 4, 12:18 pm, NMarcuwrote: > Hello, > I have this: > > value="Controller 1"/> > > and the script: > > > $(document).ready(function() { > $("#device_name").keyup(function() { > alert("Something"); > }); > }); > > > ...what I do wrong, because never do the alert, when I edit the text? -- 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.
jquery, keyup event on a text input
Hello, I have this: and the script: $(document).ready(function() { $("#device_name").keyup(function() { alert("Something"); }); }); ...what I do wrong, because never do the alert, when I edit the text? -- 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 tutorial: TemplateDoesNotExist at /admin/
I have reinstalled django and now work ^_^ - On Jan 3, 5:52 pm, Daniel Rosemanwrote: > On Jan 3, 1:52 pm, nameless wrote: > > > > > I am using tutorial on django official documentation. But when I point > > tohttp://127.0.0.1:8000/admin/, I get this error: > > > TemplateDoesNotExist at /admin/ > > > admin/login.html > > > Request Method: GET > > Request URL: http://127.0.0.1:8000/admin/ > > Exception Type: TemplateDoesNotExist > > Exception Value: > > > admin/login.html > > > Exception Location: /usr/local/lib/python2.6/dist-packages/django/ > > template/loader.py in find_template_source, line 74 > > Python Executable: /usr/bin/python > > Python Version: 2.6.2 > > Python Path: ['/home/nameless/Django-1.1.1/social', '/usr/lib/ > > python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib- > > tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/ > > usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/ > > Numeric', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/ > > dist-packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/ > > lib/python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/ > > python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages'] > > Server time: Sun, 3 Jan 2010 07:47:21 -0600 > > Template-loader postmortem > > > Django tried loading these templates, in this order: > > > * Using loader > > django.template.loaders.filesystem.load_template_source: > > * Using loader > > django.template.loaders.app_directories.load_template_source: > > > I am using Ubuntu 9.10 please help :-\ > > Did you add 'django.contrib.admin' to INSTALLED_APPS in your > settings.py? > -- > 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: How to check the validity of a field(unique property) from template?
On Jan 4, 8:18 am, NMarcuwrote: > Hello all, > > I want to check the fields from web interface before those to be > added in db. If one field already exist to get a message like: > "Already exist". I want to not perform the add action, if all fields > are not validated. This isn't something that you do in the template. It should happen in the view. -- 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.
How to check the validity of a field(unique property) from template?
Hello all, I want to check the fields from web interface before those to be added in db. If one field already exist to get a message like: "Already exist". I want to not perform the add action, if all fields are not validated. -- 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.