User is in models.py

2008-07-08 Thread Haku
Hello all! Is it possible to find out current user id form "myapp/models.py" file so i can customize the way it is saved from the admin interface? I'd like to do something like class Myapp(models.Model): ... ... def save(self): if user.is_superuser:

Re: AutoImageField From Custom upload and filters

2008-07-08 Thread Milan Andric
On Tue, Jul 8, 2008 at 10:02 AM, moos3 <[EMAIL PROTECTED]> wrote: > > does any know why the auto_rename loses the file name but not the > extension? Not familiar with auto_rename but maybe if you show a little code and explain what you are trying to do then someone can help. -- Milan

How to use combined indices (esp. in fulltext queries)?

2008-07-08 Thread ToSH
Hi, I would need to do a query like SELECT * FROM mytable WHERE match (a) against("+AAA" in boolean mode) and match (b against("+BBB" in boolean mode) and match (a,b) against("+AAA +BBB" in boolean mode) If I would omit the last line (which seems to be redundant) I could do this easily with the

Re: newforms-admin, forms.ModelForm, formtools.preview

2008-07-08 Thread Milan Andric
On Tue, Jul 8, 2008 at 10:00 AM, Milan Andric <[EMAIL PROTECTED]> wrote: > On Mon, Jul 7, 2008 at 6:22 AM, d-rave <[EMAIL PROTECTED]> wrote: >> >> Has anyone successfully got formtools.preview working with >> forms.ModelForm so that the form fields are populated from the model. >> >> If so, do

AutoImageField From Custom upload and filters

2008-07-08 Thread moos3
does any know why the auto_rename loses the file name but not the extension? --~--~-~--~~~---~--~~ 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

Re: newforms-admin, forms.ModelForm, formtools.preview

2008-07-08 Thread Milan Andric
On Mon, Jul 7, 2008 at 6:22 AM, d-rave <[EMAIL PROTECTED]> wrote: > > Has anyone successfully got formtools.preview working with > forms.ModelForm so that the form fields are populated from the model. > > If so, do you have an example?? Dave, I'm not familiar with formtools but if all you want

Re: "ColorField"?

2008-07-08 Thread Peter Herndon
You'll want to check out django.db.models.fields, django.db.models.fields.subclassing, and django.core.validators as starting points for creating a new Field type with a custom validator. In addition, there's a js attribute for class Admin you can use to bring in the necessary JavaScript into

Re: Admin interface using my views

2008-07-08 Thread Stuart Grimshaw
On Jul 8, 2:40 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-07-08 at 06:22 -0700, Stuart Grimshaw wrote: > > I'm getting this error when trying to view my admin interface ... > > > In template /usr/lib/python2.5/site-packages/django/contrib/admin/ > >

Re: Sort a list of objects by an attribute of the objects

2008-07-08 Thread joshuajonah
Resolved. Answer for those interested: def sort_by_attr(seq, attr): import operator intermed = map(None, map(getattr, seq, (attr,)*len(seq)), xrange(len(seq)), seq) intermed.sort() return map(operator.getitem, intermed, (-1,) *

Re: string indices must be integers error in admin - don't know where to start debugging

2008-07-08 Thread Jon Loyens
Problem solved. Just need to copy in my local version of Django On Jul 7, 6:29 pm, Jon Loyens <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I've got a problem and I don't even know where to start debugging > it... there seems to be a difference between the way my app is > behaving between my

Sort a list of objects by an attribute of the objects

2008-07-08 Thread joshuajonah
Ok i have a list of form fields, i want to sort the list by the ".label" of the fields. I have tried a many different ways but i cant seem to make this work. I know this is more of a python question but this is the best resource I've found for these questions. Can anybody throw an example up

Re: Admin interface using my views

2008-07-08 Thread Malcolm Tredinnick
On Tue, 2008-07-08 at 06:22 -0700, Stuart Grimshaw wrote: > I'm getting this error when trying to view my admin interface ... > > In template /usr/lib/python2.5/site-packages/django/contrib/admin/ > templates/admin/base.html, error at line 28 > Caught an exception while rendering: Tried

Admin interface using my views

2008-07-08 Thread Stuart Grimshaw
I'm getting this error when trying to view my admin interface ... In template /usr/lib/python2.5/site-packages/django/contrib/admin/ templates/admin/base.html, error at line 28 Caught an exception while rendering: Tried showSides in module teamsheet.sheets.views. Error was: 'module' object has

Re: Calendar of Events

2008-07-08 Thread Mario
I looked at the 3captus.com/download/django_calendar, but found it to be somewhat cumbersome in terms of functionality. I don't want anonymous users to create or delete calendar of events. Any more suggestions or ideas? -Mario On Jul 7, 11:29 pm, bedros <[EMAIL PROTECTED]> wrote: > I was

Re: determining model subclass

2008-07-08 Thread Chester
André, I'm assuming that you are using the Trunk version of Django because subclassing isn't supported in previous versions. Assuming that. You can either have Item be an Abstract class which does not act like a table but just a parent class containing common items. (this is not what you are

How to change ordering of m2m-fields in newforms-admin?

2008-07-08 Thread spacetaxi
Hello all, maybe there are some newforms-admin experts out there: What's the right way to change the ordering of ManyToMany-fields (displayed as select widgets) in newforms-admin? I need to change the ordering *without* changing the respective model class. Background: The default ordering of

Re: How to force user login before do anything

2008-07-08 Thread cschand
If your REQUIRE_LOGIN_PATH is different in settings you can use this middleware http://www.djangosnippets.org/snippets/136/ Satheesh On Jul 8, 2:25 pm, Daniel Hepper <[EMAIL PROTECTED]> wrote: > Writing a middleware is probably a good solution. > > You can use this >

Re: How to create field not stored in database, but visible in admin?

2008-07-08 Thread Malcolm Tredinnick
On Tue, 2008-07-08 at 11:49 +0200, Marek Stępniowski wrote: > How to create a field that is not stored in database, but is visible > in Django newforms-admin? (I'm assuming there is a way) A model "field" is something that is stored in the database, by definition. If it's not stored in the

Re: not allowing me to login to admin site

2008-07-08 Thread James Bennett
On Tue, Jul 8, 2008 at 4:33 AM, allisongardner <[EMAIL PROTECTED]> wrote: > Will look further into problem as it does not accept any of my user > logins that have been created by the admin site, even though I know i > am using the correct username and password. I do have shell access as > I am

How to create field not stored in database, but visible in admin?

2008-07-08 Thread Marek Stępniowski
How to create a field that is not stored in database, but is visible in Django newforms-admin? (I'm assuming there is a way) I would like to define a field which acts as a kind of proxy. Setting and getting value of this field actually runs some defined operation (for example executes custom SQL

Re: not allowing me to login to admin site

2008-07-08 Thread allisongardner
Hi Daniel, No i didn't consider salted hashes (I have never heard of them is the reason lol). I have now reset it to the hash as you suggested and I can now login in. THANK YOU!!! Will look further into problem as it does not accept any of my user logins that have been created by the admin site,

Re: not allowing me to login to admin site

2008-07-08 Thread allisongardner
Sorry just to add I am a newbie. I looked up previous questions and found: "I'm greatly enjoying this excellent project. However, I have a problem with users created through the admin web interface being able to log into the admin site. I get "Please enter a correct username and password." Even

Re: How to force user login before do anything

2008-07-08 Thread Daniel Hepper
Writing a middleware is probably a good solution. You can use this one: http://superjared.com/entry/requiring-login-entire-django-powered-site/ HTH, Daniel Am Dienstag, den 08.07.2008, 02:13 -0700 schrieb [EMAIL PROTECTED]: > Django offers @login_required to redirect user to login method. >

Re: runserver with manage.py works but doesn't work with django-admin.py

2008-07-08 Thread Evert
> so it's odd that my new project works with "python manage.py > runserver" but gives me an error when i do "django-admin.py > runserver." how is this possible? Is it? Have a look inside manage.py: " try: import settings # Assumed to be in the same directory. except ImportError: import

Re: not allowing me to login to admin site

2008-07-08 Thread Daniel Hepper
Hi! When you change the password with phpmyadmin, did you consider that passwords are not stored in plaintext, but as salted hashes? You can try to set it to this value: sha1$3a68b$7fbea95491a9d04e3cf647d5c8e675da69e1d458 This should set your password to 'passwort' (without apostrophes).

How to force user login before do anything

2008-07-08 Thread [EMAIL PROTECTED]
Django offers @login_required to redirect user to login method. But, If the site force user to login at first before they can do something, I have to add @login_required to every views. How to solve this problem with a more elegent way? --~--~-~--~~~---~--~~ You

not allowing me to login to admin site

2008-07-08 Thread allisongardner
Hi! I went away for the weekend, when all was working fine, and having come back to work I have found that I cannot login to the admin site. Checked the database users passwords and they had automatically changed themselves to random strings. I changed the user password back in phpmyadmin but

Re: Inserting html into a page dynamically

2008-07-08 Thread Bear
Thx to both of you, I'll do it with AJAX then. I'll have to find a way to make this work anyway if the user doesn't have Javascript enabled. Bibi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Non ForeignKey field type as

2008-07-08 Thread Daniel Hepper
You can use the choices option in your model. http://www.djangoproject.com/documentation/model-api/#choices class Details(models.Model): ... PROJECT_TYPES = ( ('A', 'Type A'), ('B', 'Type B'), ) project_type = models.CharField(max_length=30,choices=PROJECT_TYPES)

Re: Ajax in Django

2008-07-08 Thread Matthias Kestenholz
On Mon, 2008-07-07 at 21:50 -0700, bharathi wrote: > I am creating one Django application with jquery.. > In that Jquery function am using One Ajax script.. Django code cant > taken that ajax code... > > My code is: > > $(document).ready( > function () { >

Re: Using validators against model fields

2008-07-08 Thread Ayaz Ahmed Khan
On Jul 8, 9:50 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > Django does not do any model field validation by default at the moment. > Admin does it using an old system (essentially, oldforms and Add- and > ChangeManipulators) that is being removed. We are adding more coherent > model

Re: common problem: set author, update date on save

2008-07-08 Thread Daniel Hepper
Hi! > on saving a Post > wish to set created_on and updated_on You can use a date time field with auto_now_add one with and auto_now for that. http://www.djangoproject.com/documentation/model-api/#datetimefield Regards, Daniel --~--~-~--~~~---~--~~ You received

Re: Ajax in Django

2008-07-08 Thread Kenneth Gonsalves
On 08-Jul-08, at 10:20 AM, bharathi wrote: > I am creating one Django application with jquery.. > In that Jquery function am using One Ajax script.. Django code cant > taken that ajax code... this code must be put in the HEAD section of the html - so create a block 'head' in the head

Ajax in Django

2008-07-08 Thread bharathi
I am creating one Django application with jquery.. In that Jquery function am using One Ajax script.. Django code cant taken that ajax code... My code is: $(document).ready( function () { $("#sortme").Sortable( {

Can url tags work with single quoted strings?

2008-07-08 Thread pgb
Hi Just a quick query Can url tags work with single quoted strings? Another words why {% url my.view 'some_string' %} doesn't work but {% url my.view ''some_string" %} works fine? Could you add a small example about using quoted strings with tags, like the above one, to

determining model subclass

2008-07-08 Thread Andre Meyer
hi all is it possible to determine the subclass of a model instance? what i mean is this: if you have a (n abstract) model class and two subclasses, like class Item(models.Model): pass class Task(Item): pass class Event(Item): pass and you retrieve items = Item.objects.all()

<    1   2