Re: best practice override admin 1.2 "delete"?

2011-04-15 Thread Mengu
Hi, I've just asked in the #django channel. Read this http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.queryset. On Apr 15, 6:27 am, λq wrote: > Thanks Mengu, > > I have another question: > > how to set admin's default view NOT to display items if is_delete

Re: best practice override admin 1.2 "delete"?

2011-04-15 Thread λq
Wow, this is exactly what I am looking for. Thanks a million! :D 2011/4/15 Mengu > Hi, > > I've just asked in the #django channel. Read this > > http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.queryset > . > > On Apr 15, 6:27 am, λq wrote: > > Thanks Meng

Django 1.3 and multilingual

2011-04-15 Thread andreap
Hello all, i updeted my app to django 1.3 and stop to work my custom admin. use_fieldsets = [ (None, {'fields': ('photo1', 'title',)}), ] i have this error Unknown field(s) (title) specified for HomePage when i dont use use_fieldsets the admin work but i need to custom the order of

Re: best practice override admin 1.2 "delete"?

2011-04-15 Thread Mengu
glad it did work :) On Apr 15, 10:32 am, λq wrote: > Wow, this is exactly what I am looking for. Thanks a million! :D > > 2011/4/15 Mengu > > > > > > > > > Hi, > > > I've just asked in the #django channel. Read this > > >http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contri... >

Re: Error: No module named mysql.base when trying to sync.db

2011-04-15 Thread paganplan paganplan
Solved! in settings.py file, option 'ENGINE' must be like this: django.db.backends.mysql 2011/4/14, pagan : > same problem. apache2, mod_wsgi, python-mysqldb installed. When i add > databases engine, name, user, password in settings.py, i got a > message: > > ImportError at /wsgi > No module named

OneToOne relationship - id displayed in admin instead of object name?

2011-04-15 Thread Sithembewena Lloyd Dube
Hi everyone, I have a class definition as follows in my models: class BlogUser(models.Model): *blogger = models.OneToOneField(User)* *# User being the django.contrib.auth.models user* featured =models.BooleanField() url =

Customizing error message in ModelForm

2011-04-15 Thread het.oosten
I want to show a custom error message in a Modelform. With a normal form I can add an error message like this: error_messages={'required': 'Vul aub een geldig Email adres in', 'invalid': 'Het email adres is niet geldig'} With a ModelForm this won't work. Is there a way to add a custom error messa

Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-15 Thread roberto
You can also have a look at askbot. It seems to have more functionalities. Good luck ! www.askbot.org On Apr 14, 6:43 pm, AJ wrote: > Why has this become a case for me? I just wanted to know about a particular > solution, that whether it exists or not. I did try Google and other forums. > > I ne

Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-15 Thread Daniel Hilton
On 15 April 2011 13:01, roberto wrote: > You can also have a look at askbot. > It seems to have more functionalities. > Good luck ! > > www.askbot.org > > On Apr 14, 6:43 pm, AJ wrote: >> Why has this become a case for me? I just wanted to know about a particular >> solution, that whether it exis

Re: Customizing error message in ModelForm

2011-04-15 Thread Martin Pajuste
Error messages in ModelForms work perfectly fine. class PersonForm(forms.ModelForm): first_name = forms.CharField(error_messages={'required': 'Please enter your first name!'}) class Meta: model = Person http://docs.djangoproject.com/en/dev/ref/forms/fields/#error-messages -- Y

Re: Customizing error message in ModelForm

2011-04-15 Thread het.oosten
@Martin Thank you for your reply. I tried to do this, but I still get the default error message (the custom error from the code field works as it should): from django.db import models from django.forms import ModelForm from django import forms class Prijsvraag(models.Model): naam = mode

remove items from queryset for nested regrouping

2011-04-15 Thread Mo Mughrabi
Hi, I've been working on a project that takes into consideration performance as the top priority therefore am trying to use single to queries at each page to collect all the needed information. Any who, I got to a point where I have one query set that need to be regrouped based on column (left, r

Re: Customizing error message in ModelForm

2011-04-15 Thread Martin Pajuste
This should do the trick: class PrijsvraagForm(ModelForm): mail = forms.EmailField(error_messages={'required':'Vul aub een geldig Email adres in', 'invalid': 'Het email adres is niet geldig'}) class Meta: model = Prijsvraag def clean_code(self): super(PrijsvraagForm,

Re: Customizing error message in ModelForm

2011-04-15 Thread het.oosten
Yes indeed! Thank you very much for your help. Rob -- 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...@goog

Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-15 Thread AJ
Thanks a lot for that suggestion. On Apr 15, 2011 8:52 AM, "Daniel Hilton" wrote: > On 15 April 2011 13:01, roberto wrote: >> You can also have a look at askbot. >> It seems to have more functionalities. >> Good luck ! >> >> www.askbot.org >> >> On Apr 14, 6:43 pm, AJ wrote: >>> Why has this be

Re: satchmo currency

2011-04-15 Thread Chris Moffitt
First off, you'll probably get better responses on the Satchmo list. Secondly, changing languages doesn't change currency symbols, which should make sense. 1 Euro is not equal to 1 Dollar. If we were to change symbols, we'd also need to do a currency conversion. It's not impossible by any means ju

SQL Server

2011-04-15 Thread Mike Kenny
Hi, I am trying to use a django application developed on Linux with MySQL on a Windows box with SQL Server. I have downloaded pyodbc and set my ENGINE to sql_server.pyodbc (and tried just pyodbc as I was able to import this into python but not sql_server). Both result in an error message listing t

Re: SQL Server

2011-04-15 Thread Jirka Vejrazka
Mike, I use exactly the same setup. Look up the "django-odbc" package. This will be quite easy to use and setup, but there are some unresolved bugs in that package related to multi-db support. Most of them have patches attached to their tickets. Cheers Jirka On 15/04/2011, Mike Kenny

Re: SQL Server

2011-04-15 Thread Javier Guerra Giraldez
On Fri, Apr 15, 2011 at 9:25 AM, Jirka Vejrazka wrote: >  I use exactly the same setup. Look up the "django-odbc" package. > This will be quite easy to use and setup, but there are some > unresolved bugs in that package related to multi-db support. Most of > them have patches attached to their tic

ie9 and localhost hangs

2011-04-15 Thread Kurdy
This week I installed the latest windows 7 microsoft updates. Also since a few days, IE9 hangs when I try to connect to http://127.0.0.1:8000 I do not see any movement on the Django development server DOS-screen. Firefox4 is OK, and connecting to Opera11 at the same time: no problem. But IE9 hangs

Re: remove items from queryset for nested regrouping

2011-04-15 Thread Mo Mughrabi
Ok its solved now, I updated my nested regroup with the following {% regroup dict by col_mapper as column_gr %} {% for column in column_gr %} {{ column.grouper }} {% with column.list as groupr %} {% regroup groupr by main_tit

Please Help a django Beginner!

2011-04-15 Thread Aviv Giladi
Hey guys, I am an experienced Python developer starting to work on web service backend system. The system feeds data (constantly) from the web to a MySQL database. This data is later displayed by a frontend side (there is no connection between the frontend and the backend). The backend system cons

Re: Please Help a django Beginner!

2011-04-15 Thread Jirka Vejrazka
I use Djano ORM for a lot of my backend processing where no web is involved. Just make sure that DJANGO_SETTINGS_MODULE is defined in your environment and you can use pretty much any part of Django in your own code/scrits/whatever. HTH Jirka On 15/04/2011, Aviv Giladi wrote: > Hey guys,

Can a OneToOne field be used to generate the value of a SlugField in the same model?

2011-04-15 Thread Sithembewena Lloyd Dube
Hi, I have a model which defines a blogger property, which is a OneToOne field on the django.contrib.auth.models.User model as follows: class BlogUser(models.Model): blogger = models.OneToOneField('auth.User', related_name='blogger') url = models.SlugField(max_length=125, unique=True, hel

Re: base.html (extended by others) has to be in project (not app) root?

2011-04-15 Thread Joel Goldstick
On Thu, Apr 14, 2011 at 4:50 PM, Yuka Poppe wrote: > Hi Jeff, > > I think Gladys is correct, the reason for your code finding the index > template, is because its probably looking for 'myapp/index.html' > instead of just 'index.html' > > Im not really sure if you're also distinguishing between th

change extension of uploaded image

2011-04-15 Thread ozgur yilmaz
Hi, I want to change the filetype of any uploaded image to JPG. What is the most efficient way for this? I think i surely do this before save(). Any ideas? Thanks, -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema

Re: change extension of uploaded image

2011-04-15 Thread ozgur yilmaz
My solution is: def save( self ): if self.image1: original = Image.open( self.image1 ) if original.mode not in ('L', 'RGB'): original = original.convert('RGB') cp_image = original.copy() cp_image_handle = StringIO() cp_image.save( cp_image_handle, 'JPEG'

Form with two select boxes + javascript - selection gets destroyed???

2011-04-15 Thread Joakim Hove
Hello; I have a problem with a Django using JavaScript which I really don't understand. It must be said that this is my first time using JavaScript to beef up my forms - that might be source of the problem. The form presents the user with two drop down selectors and a submit button like: Co

Re: Please Help a django Beginner!

2011-04-15 Thread Aviv Giladi
Thank you for the response. Is there any documentation / books out there that you would recommend reading to get acquainted with django in that perspective? On Apr 15, 10:58 am, Jirka Vejrazka wrote: > I use Djano ORM for a lot of my backend processing where no web is > involved. Just make sure t

pagination peculiarities...

2011-04-15 Thread Markus T.
Hi everybody, I have a strange effect using pagination. I have a model with events that have a date, time, title, description field and so on. I display the events using pagination. In the model's Meta class I tell Django to order by date. I create a queryset like this: events = Event.objects.f

Re: Form with two select boxes + javascript - selection gets destroyed???

2011-04-15 Thread Shawn Milochik
Two things: 1. Does your form use a prefix? 2. Please post a relevant excerpt of your request.POST data. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe

Re: Form with two select boxes + javascript - selection gets destroyed???

2011-04-15 Thread Joakim Hove
Thank you for answering: On Apr 15, 8:47 pm, Shawn Milochik wrote: > Two things: > >     1. Does your form use a prefix? I don't really what you mean with prefix? > >     2. Please post a relevant excerpt of your request.POST data. (I mangled things a bit up in the original message; in particu

New python, django user... having issues

2011-04-15 Thread Vang
Hi there. I'm trying to install Django on my computer, but I'm having problems. Any help would be really, really appreciated. My first attempt was with the BitNami Django Stack. It seemed to have installed, but I couldn't verify it through 'import django' on Idle. I played with it a few times, and

Re: Form with two select boxes + javascript - selection gets destroyed???

2011-04-15 Thread Тимур Зарипов
I suggest you to use firefox + firebug extension to see what exactly your form is sending to server in POST (or GET) request via firebug's "Console" tab. If data in request is correct every time (change both selectors, change oly one of them, without changes) -- then problem somewhere in your djang

Re: Form with two select boxes + javascript - selection gets destroyed???

2011-04-15 Thread Tim
I suggest you to use firefox + firebug extension to see what exactly your form is sending to server in POST (or GET) request via firebug's "Console" tab. If data in request is correct every time (change both selectors, change oly one of them, without changes) -- then problem somewhere in your djang

Re: Form with two select boxes + javascript - selection gets destroyed???

2011-04-15 Thread Shawn Milochik
Can you show us the field declaration in your form -- specifically the value of 'choices'? In an item is not in the original choices then it's invalid. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-

Re: Form with two select boxes + javascript - selection gets destroyed???

2011-04-15 Thread Joakim Hove
Thank you to everyone answering - I will look into the Firebug approach the next time. But now I am 99.9% certain that > In an item is not in the original choices then it's invalid. This is the problem. In the cases where things failed the choice eventually sent from the client was not in the ini

Re: base.html (extended by others) has to be in project (not app) root?

2011-04-15 Thread Jeff Blaine
Thank you all. I will digest the replies when I have the time to properly focus back on the issue (it's obviously small, since I have a workaround in place by shoving base.html into the project root). It still, regardless of solutions, even in light of the words shared in this thread (which I'

Re: base.html (extended by others) has to be in project (not app) root?

2011-04-15 Thread Brian Neal
On Apr 15, 2:23 pm, Jeff Blaine wrote: > Thank you all.  I will digest the replies when I have the time to properly > focus back on the issue (it's obviously small, since I have a workaround in > place by shoving base.html into the project root). > > It still, regardless of solutions, even in ligh

Re: base.html (extended by others) has to be in project (not app) root?

2011-04-15 Thread Jeff Blaine
On Friday, April 15, 2011 4:21:56 PM UTC-4, Brian Neal wrote: > > You didn't post how you loaded the template in your view function. In > particular, what path string you used. > Ah. The missing piece to bring order to all of this confusion on my part. I was using "myapp/index.html", per

Passing variables to the template... I've having logic problems

2011-04-15 Thread Karen McNeil
I'm trying to make a concordance (ie, a list of a certain searchterm, including its surrounding context) and I can get it to work in the interpreter, but I'm having problems figuring out how to make it a list that I can pass it to the template. This is what works in the interpreter (tokens is a li

'Context' object has no attribute 'render_context'

2011-04-15 Thread jhen095
I'm fairly new to django and now I'm stuck on this error... 'Context' object has no attribute 'render_context' searching around has told me that render_context did not exist pre django 1.2 but I have django 1.2.4 installed. Here is some of my stack trace... AttributeError at /hsws/ 'Context' obj

Re: Passing variables to the template... I've having logic problems

2011-04-15 Thread Pedro Kroger
You can try something like: def my_view(request): ... context = [] for offset in offsets: before = ' '.join(tokens[offset-5:offset]) word = tokens[offset] after = ' '.join(tokens[offset+1:offset+5]) context.append(before, word, after) ... ..

How to unit test if user has access to page

2011-04-15 Thread Pedro Kroger
Hi, I writing some unit tests and I'd like to test if an unlogged user has access to the main dashboard page. In my application, if the user is logged it will go to the dashboard, if it isn't, it will go to the login page. I know how to get to the webpage: result = self.client.post('/dashboard/')

Re: How to unit test if user has access to page

2011-04-15 Thread Javier Guerra Giraldez
On Fri, Apr 15, 2011 at 8:54 PM, Pedro Kroger wrote: > result = self.client.post('/dashboard/') > > But I don't know how to test if the result is the dashboard or the > login page. Could you guys point me in the right direction? from the docs (http://docs.djangoproject.com/en/1.3/topics/testing/

Put an "inline" at the top of admin form instead of bottom?

2011-04-15 Thread Jeff Blaine
I'm using the admin functionality for most of my needs (a nice CRUD DB frontend, not a user-facing website). Is there a best way to get one of my inline models presented at the top of the form instead of the bottom? I would greatly prefer not to have to specify all of the fields (via ModelAdm

Re: pagination peculiarities...

2011-04-15 Thread Karen Tracey
On Fri, Apr 15, 2011 at 2:44 PM, Markus T. wrote: > > I have a strange effect using pagination. > > I have a model with events that have a date, time, title, description > field and so on. I display the events using pagination. In the model's > Meta class I tell Django to order by date. > > I crea

Re: Passing variables to the template... I've having logic problems

2011-04-15 Thread Karen McNeil
Yes, that worked. Thank you! Of course, now that I fixed that, I have to deal with the other problem that I was avoiding... But I'll post that in a different question. :-) Thanks again, Pedro. On Apr 15, 9:35 pm, Pedro Kroger wrote: > You can try something like: > > def my_view(request): >  

Using request.GET and having issues

2011-04-15 Thread Karen McNeil
I have the following view set up: def concord(request): searchterm = request.GET['q'] ... more stuff ... return render_to_response('concord.html', locals()) With URL "http://mysite.com/concord/?q=برشه";, and template code Your search for {{ searchterm }} returned {{ results }} re