Re: How to limit a ManyToManyField to three choices?

2011-03-12 Thread bagheera
Dnia 11-03-2011 o 22:45:34 greenie2600 napisał(a): 'Restaurant' instance needs to have a primary key value before a many- to-many relationship can be used. That is the answer You need to understand. afiak You can't perform m2m validation on model level due that very

Re: How to limit a ManyToManyField to three choices?

2011-03-11 Thread bagheera
Dnia 11-03-2011 o 21:39:01 bagheera <neost...@go2.pl> napisał(a): Dnia 11-03-2011 o 21:29:29 greenie2600 <greenie2...@gmail.com> napisał(a): bagheera - I had seen the limit_choices_to parameter, but I thought it controlled *which* choices are available to the user - not *how m

Re: How to limit a ManyToManyField to three choices?

2011-03-11 Thread bagheera
Dnia 11-03-2011 o 21:29:29 greenie2600 <greenie2...@gmail.com> napisał(a): bagheera - I had seen the limit_choices_to parameter, but I thought it controlled *which* choices are available to the user - not *how many* they're allowed to choose. I want to show the user a list of 20

Re: How to limit a ManyToManyField to three choices?

2011-03-11 Thread bagheera
Dnia 11-03-2011 o 21:29:29 greenie2600 <greenie2...@gmail.com> napisał(a): bagheera - I had seen the limit_choices_to parameter, but I thought it controlled *which* choices are available to the user - not *how many* they're allowed to choose. I want to show the user a list of 20

Re: How to limit a ManyToManyField to three choices?

2011-03-11 Thread bagheera
Dnia 11-03-2011 o 21:23:38 greenie2600 napisał(a): gontran - Thanks. However, I tried the sample code in your link, and I don't think it will work. Returning a string from the overridden save() method prevents the record from being saved to the database, but by the

Re: How to limit a ManyToManyField to three choices?

2011-03-11 Thread bagheera
Dnia 11-03-2011 o 18:06:43 greenie2600 napisał(a): Hi all - I have two models with a many-to-many relationship: Restaurant and Cuisine. The Cuisine table contains, e.g., "Italian", "Mexican", "Chinese", etc. Each Restaurant record can be associated with one or more

Re: validate changes in m2m field in admin panel

2011-02-11 Thread bagheera
Dnia 11-02-2011 o 19:36:16 Piotr Zalewa <zal...@gmail.com> napisał(a): I would use signals for that purpose On 11-02-11 10:18, bagheera wrote: Hi, i would like to perform validation on m2m field to control, if user made any changes. I'd like to disallow removing relations from m2m

validate changes in m2m field in admin panel

2011-02-11 Thread bagheera
Hi, i would like to perform validation on m2m field to control, if user made any changes. I'd like to disallow removing relations from m2m field, only adding them. example: model Product(models.Model): name = models.TextField() model Order(models.Model): products =

Re: how to retreive the body text alone of a webpage

2010-10-02 Thread bagheera
Dnia 02-10-2010 o 15:10:33 jimgardener napisał(a): hi I am writing an application to find out if the body text of a web page of given url has been modified-added or removed.Is there some way to find out the length of body text alone? I wrote a function that can read and

Re: IDE for Python/django

2010-09-27 Thread bagheera
Dnia 27-09-2010 o 15:00:51 girish shabadimath napisał(a): actually i use vim for writing python scripts , i wanted IDE to easy my tasks of writing script (like auto-completion) ,,,i dont want GUI based,,i prefer editor like vim which supports python scripts

Re: IDE for Python/django

2010-09-27 Thread bagheera
Dnia 27-09-2010 o 14:51:15 girish shabadimath napisał(a): hi all, is there any IDE for Python/Django ? Most will probably recommend Eclipse + pydev plugin or Aptana + pydev. I fell quite comfortable with NetBeans. Unfortunately it doesn't support django

Re: error in urlconf

2010-09-25 Thread bagheera
Dnia 25-09-2010 o 22:04:16 Tim Sawyer napisał(a): On 25/09/10 20:39, CarloRatm wrote: http://pastebin.com/aY6tZm6j What's wrong with that code ? Thank you, cheers ^blog/ ^(?Pd+)$ should be ^blog/ ^(?P\d+)/$ ?? Tim. use raw definitions like django docs

Re: error in urlconf

2010-09-25 Thread bagheera
Dnia 25-09-2010 o 21:39:15 CarloRatm napisał(a): http://pastebin.com/aY6tZm6j What's wrong with that code ? Thank you, cheers http://docs.djangoproject.com/en/1.2/topics/http/urls/#example And check what ^ char mean

Re: How to debug ORM filter stacking?

2010-09-25 Thread bagheera
Dnia 25-09-2010 o 06:17:10 ydjango napisał(a): I am stacking filters on queryset. For some reason the second filter in stack is not applying and it is not giving any error either. Any way to debug what is going on? python manage.py shell Import ur model, and build ur

Re: Django 1.2.1. admin WYSIWYG editor

2010-09-22 Thread bagheera
Dnia 22-09-2010 o 14:41:56 Sithembewena Lloyd Dube napisał(a): btw, it's an ordinary, pure tinyMCE, downloaded directly from their website -- Linux user -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Django 1.2.1. admin WYSIWYG editor

2010-09-22 Thread bagheera
ny_mce_config.js',) in SETTINGS.py: MEDIA_ROOT = '/home/bagheera/NetBeansProjects/nml-src/storage' MEDIA_URL = '/site_media/' so path to tiny_mce.js file would be: /home/bagheera/NetBeansProjects/nml-src/storage/js/tiny_mce/tiny_mce.js -- Linux user -- You received this message because you are subscribed to t

Re: Django 1.2.1. admin WYSIWYG editor

2010-09-21 Thread bagheera
Dnia 21-09-2010 o 17:41:26 Sithembewena Lloyd Dube napisał(a): Hi, Has anybody intergrated a WYSIWYG editor in the admin of a Django 1.2.1. site? I have tried django-wysiwyg and TinyMCE to no avail. I need something with concise, up-to-date documentation. If anybody

Re: __unicode__() doesn't seem to work

2010-09-15 Thread bagheera
Dnia 15-09-2010 o 13:35:15 Hayko Karapetyan napisał(a): from django.db import models class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return

Re: __unicode__() doesn't seem to work

2010-09-15 Thread bagheera
Dnia 15-09-2010 o 12:47:55 Hayko napisał(a): my django version is 1.2.1 but the __unicode__() doesn't seem to work what shall i do? thanx a lot...! Post code and traceback. We ain't wizards with crystal balls :D -- Linux user -- You received this message

Re: django tinyMCE is normal text field instead of rich text formatting? a fix please.

2010-09-14 Thread bagheera
Dnia 13-09-2010 o 18:57:35 tricks...@googlemail.com napisał(a): I installed Django tiny mce however i am getting a normal text area in my admin. Can anyone help me to correct this to a rich text area where i can access text formatting? I just downloaded newest tinyMCE

Re: Django webiste down

2010-09-09 Thread bagheera
Dnia 09-09-2010 o 16:43:50 Łukasz Rekucki napisał(a): Is it only me or is http://docs.djangoproject.com/ down? Works fine. -- Linux user -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Optional foreign key with django?

2010-09-09 Thread bagheera
Dnia 09-09-2010 o 11:00:29 akaariai napisał(a): On Sep 8, 11:14 pm, maroxe wrote: Hi, In my models I want to have an optional field to a foreign key. I tried this: field = models.ForeignKey(MyModel, null=True, blank=True, default=None) But i am

Re: home page menu view variables cross every view?

2010-09-08 Thread bagheera
Dnia 08-09-2010 o 15:41:13 Goran napisał(a): Thanks for your help but I think that understand how template works. My menu is drop down menu with menu items which comes from variable {{ for menuitem in myvariable }} {{ menuitem.title }} {{ endfor }} and myvariable is in my

model validation with admin.TabularInline

2010-08-20 Thread bagheera
Take a look into pool app from django tutorial. How can i make validation of Question model to have at least two Answer entered, if admin.TabularInline is used? http://docs.djangoproject.com/en/1.2/intro/tutorial02/#adding-related-objects -- Linux user -- You received this message

Re: query evaluation problem [SOLVED]

2010-08-16 Thread bagheera
efault = lambda : get_val(Newspaper.objects.aggregate(Max('number' http://docs.djangoproject.com/en/1.2/topics/db/aggregation/#topics-db-aggregation Just define get_next to call the Max aggregate on your Newspaper model's number field. On Mon, Aug 16, 2010 at 12:39 PM, bagheera <neost.

Re: query evaluation problem

2010-08-16 Thread bagheera
Dnia 16-08-2010 o 19:56:01 Nick napisał(a): How about using an autofield? Nope. Autofield requires primary_key=True, filed need to be editable, so user can add values unordered, (10,11,12,13,17,25,9) I'm checking out aggregation functions now. -- Linux user -- You

query evaluation problem

2010-08-16 Thread bagheera
Hi, i have "number" field in "newspaper" model. I want assign to it dynamically a default value, witch would be a incremented by 1 highest value so far. So i managed to make a little workaround, since i can't query for last value of "number" field of model from model itself. I have

Re: Can't build Django documentation

2010-08-14 Thread bagheera
Dnia 14-08-2010 o 05:11:25 Kevin napisał(a): I tried to build the Django docs and got an error. $ cd django/docs/ $ make html sphinx-build -b djangohtml -d _build/doctrees . _build/html Running Sphinx v1.0.1 loading pickled environment... not yet created building

generating random keys/passwords

2010-08-13 Thread bagheera
Hi, i'm looking for python module to generate random strings used as activation keys to being sent to newsletter subscribers in order to activate their subscription. Any suggestions? -- Linux user -- You received this message because you are subscribed to the Google Groups "Django users"

Re: overwrite the save method

2010-08-11 Thread bagheera
-- class Format(models.Model): name = models.CharField(max_length=5, unique=True) myBoolean = models.BooleanField(default=False) class FormFormat(forms.ModelForm): boolean1 = forms.BooleanField(required=False) boolean2 =

autoincrementation of default value in admin form

2010-08-11 Thread bagheera
I have PositiveIntegerField in my model, that represents unique, new number of newly added element (it's newspaper no.). It must be editable in admin form. Now i would to assign a default value to the next available integer, so person, who will be adding new element, have that field

Re: HttpResponseRedirect

2010-08-09 Thread bagheera
Dnia 07-08-2010 o 14:56:57 JeffH napisał(a): Another approach that I used recently: # urls.py (r'^ThankYou/(?P\d{4})/$', views.ThankYou), # message defs in views.py # messages for ThankYou page ty_messages = { '' : 'Invalid message specified.', '0001' :

Re: HttpResponseRedirect

2010-08-07 Thread bagheera
Dnia 07-08-2010 o 10:29:30 bagheera <neost...@go2.pl> napisał(a): Dnia 06-08-2010 o 18:09:12 shacker <shac...@birdhouse.org> napisał(a): Why not use the Messages framework for this? http://docs.djangoproject.com/en/dev/ref/contrib/messages/ ./s That looks promising, i'll t

Re: HttpResponseRedirect

2010-08-07 Thread bagheera
Dnia 06-08-2010 o 18:09:12 shacker napisał(a): Why not use the Messages framework for this? http://docs.djangoproject.com/en/dev/ref/contrib/messages/ ./s That looks promising, i'll try to figure that out. -- Linux user -- You received this message because you are

HttpResponseRedirect

2010-08-06 Thread bagheera
I have two pages with two different forms. Each, if validated, redirects to "thanks" page. I want to customize this behavior, so "thanks" page should display different message, regarding witch form was invoked, or redirects to "/' if no redirection took place (like user typed in browser

Re: django.views.static.serve issue

2010-08-05 Thread bagheera
Dnia 05-08-2010 o 14:57:04 Reinout van Rees <rein...@vanrees.org> napisał(a): On 08/05/2010 01:36 PM, bagheera wrote: Hi, i set up static files for development purposes in following way: urls.py: if settings.DEBUG: urlpatterns += patterns('',(r'^site_med

django.views.static.serve issue

2010-08-05 Thread bagheera
Hi, i set up static files for development purposes in following way: urls.py: if settings.DEBUG: urlpatterns += patterns('',(r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),) settings.py: MEDIA_ROOT = '/home/bagheera/NetBeansProjects/nml

Re: Django IDE

2010-08-05 Thread bagheera
Dnia 05-08-2010 o 00:12:41 Carlos Daniel Ruvalcaba Valenzuela napisał(a): If you are looking for a "Full IDE" I have used Eclipse+PyDev (and other plugins) and works quite well, completion is reasonable and you have a wealth of extensions such as VCS support, Mylyn

Re: Django IDE

2010-08-04 Thread bagheera
For python/django development i'm using... NetBeans! It fails to autocomplete items properly, but still, i find it most comfortable also for html, javaScript, CSS. Sometimes i use Geany, it's really simple, yet nice IDE. All under Linux. -- You received this message because you are

modify default admin action - delete_selected

2010-08-03 Thread bagheera
Lets say i have a Person model and a book model. Each Person can have many books. Person model have PositiveIntegerField that stores, how many books that person has. If new book is added, respective counter is incremented, now i want to modify default admin action - delete_selected, so it

Re: uncomplete internationalization of 'auth' in admin panel

2010-08-03 Thread bagheera
Dnia 29-07-2010 o 23:17:13 Dennis Kaarsemaker <den...@kaarsemaker.net> napisał(a): On do, 2010-07-29 at 13:43 -0700, bagheera wrote: Internationalization of 'auth' app in django 1.2 isn't complete. In user edit form there are user permissions displayed in two windows, like "auth |

uncomplete internationalization of 'auth' in admin panel

2010-07-29 Thread bagheera
Internationalization of 'auth' app in django 1.2 isn't complete. In user edit form there are user permissions displayed in two windows, like "auth | permission | Can add permission", etc. I want it all fully localized, but i can't digg up right code. Any ideas how to solve that? -- You received