Re: per object permissions, caching and templates?

2008-07-25 Thread Hanne Moa
On Fri, Jul 25, 2008 at 11:39 AM, Bram de Jong <[EMAIL PROTECTED]> wrote: > For freesound.org I really need per-object permissions and caching. > I would also love to use the {% cache %} template tag as much as > possible because it's so easy and transparent! > Now, say for example I have a sound,

Re: Custom Comment Form - post_comment()

2008-09-02 Thread Hanne Moa
On Tue, Sep 2, 2008 at 12:29 PM, Thejaswi Puthraya <[EMAIL PROTECTED]> wrote: > For any general web-application, every user is expected to enter his > details like first name and last name so it's not a usual case to have > both of them empty. I have several projects written in Django up and runn

Re: Deleting user cause integrity error ... violates foreign key

2008-09-22 Thread Hanne Moa
On Fri, Sep 19, 2008 at 1:51 PM, dbee <[EMAIL PROTECTED]> wrote: > > I'm trying to delete a user from my admin panel. The system tells me > that it causes an integrity error by violating a foreign key > constraint ... > > What causes these kinds of errors ? > > IntegrityError at /admin/auth/user/2

Re: Newbie Question: How to display only error messages when form validation fails?

2008-09-22 Thread Hanne Moa
On Fri, Sep 19, 2008 at 7:34 PM, Karthik Krishnan <[EMAIL PROTECTED]> wrote: > It throws a debug error page. What Kenneth was trying to say was *which* error was in the debug error page. > On Sep 18, 10:01 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: >> On Friday 19 Sep 2008 7:02:06 am Karth

Missing attribute on User

2009-11-22 Thread Hanne Moa
I have models M, N, which both have a foreignkey to User. When in the shell/runserver, User has attributes for both M and N, but in a batchfile ($ DJANGO_SETTINGS_MODULE=settings python batch.py) only M is reachable from User while trying to get N leads to AttributeError: 'User' object has no attr

Re: Missing attribute on User

2009-11-23 Thread Hanne Moa
On Mon, Nov 23, 2009 at 00:46, Russell Keith-Magee wrote: > On Mon, Nov 23, 2009 at 1:59 AM, Hanne Moa wrote: >> I have models M, N, which both have a foreignkey to User. When in the >> shell/runserver, User has attributes for both M and N, but in a >> batchfile ($ D

Re: How to unregister model?

2009-11-24 Thread Hanne Moa
2009/11/25 Tomasz Zieliński : > That patch is a hack that requires modifying live instance of Django, > moreover I don't know what is influenced by it as I'm not that > familiar > with inner workings of model layer, so using it would be troublesome > for me. > > So it seems that I have to write cus

WTF? global name 'TemplateSyntaxError' is not defined

2009-12-13 Thread Hanne Moa
Suddenly I get this: Caught an exception while rendering: global name 'TemplateSyntaxError' is not defined The area in the template it is complaining about is in the base-template, meaning the entire dev-version is broken. I haven't changed anything in the templates lately, nor in the templatetag

Can't delete a User from within admin

2009-12-13 Thread Hanne Moa
When I try to delete a user from within the admin I get: TypeError at /admin/auth/user/ super(type, obj): obj must be an instance or subtype of type It's triggered by: File "/home/django-sites/CALS/cals/models.py" in get_query_set 99. return super(DescriptionManager, self).get_query_s

Re: Can't delete a User from within admin

2009-12-13 Thread Hanne Moa
2009/12/13 Ramiro Morales : >> The manager's self is at that moment a >> django.db.models.fields.related.RelatedManager. > > I'd suggest to read the Django documentation about managers, > in particular the sections about default managers, and how they > (are not) used by the admin application. The

Re: What exactly does order_with_respect_to do?

2009-12-15 Thread Hanne Moa
2009/12/15 smcoll : > i'd be curious to know if anyone has seen an admin implementation for > reordering with this field.  i'd also heard some chatter a while back > that this might be removed in future releases of Django, because it > leans toward the "magic" end of things I always end up making

Correct way to unlazify a SimpleLazyObject?

2009-12-18 Thread Hanne Moa
I recently got burned by r11626, which added SimpleLazyObject to 1.1.x. I have a templatetag that linkifies a user-object, and it checks whether it is given a django.contrib.auth.models.User, an int (looks up a User) or a profile (looks up the User). This check was done with type(). Unfortunately,

Re: super() argument 1 must be type, not None

2009-12-23 Thread Hanne Moa
2009/12/22 TiNo : > /../ for some reason it throws the > following error since a while (don't know since when, don't know what > changed, can't find anything suspicious in hg log...) "super() argument 1 > must be type, not None". When I run with pdb.set_trace as the first line of > the save method

Re: Best practice for maintaining the "Django stack"

2010-08-18 Thread Hanne Moa
If you put something in INSTALLED_APPS, it *is* imported, and when you test everything it is also tested. HM -- 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 fro

django-tagging is not multi-db safe

2009-12-25 Thread Hanne Moa
A site using django-tagging will break hard on 1.2 as of today. See issue http://code.google.com/p/django-tagging/issues/detail?id=233 . How is one to use as_sql() now with multi-db in? HM -- You received this message because you are subscribed to the Google Groups "Django users" group. To po

Re: django-tagging is not multi-db safe

2009-12-26 Thread Hanne Moa
2009/12/26 Russell Keith-Magee : > On Sat, Dec 26, 2009 at 3:06 AM, Hanne Moa wrote: >> A site using django-tagging will break hard on 1.2 as of today. See >> issue http://code.google.com/p/django-tagging/issues/detail?id=233 . >> >> How is one to use as_sql() now w

Re: django-tagging is not multi-db safe

2009-12-26 Thread Hanne Moa
2009/12/26 James Bennett : > On Fri, Dec 25, 2009 at 1:06 PM, Hanne Moa wrote: >> How is one to use as_sql() now with multi-db in? > > One doesn't. And, generally, one should be sticking to the stable > release of Django; Kinda hard when one wants to experiment to see

Re: Managing different user types

2010-02-11 Thread Hanne Moa
On 10 February 2010 13:27, ALJ wrote: > 1. The best way to do a simple extension of user information? > As far as I can tell, the best way is to use User Profiles. Ok. I get > that. > - "Storing Additional Information About Users" (http:// > docs.djangoproject.com/en/1.1/topics/auth/#storing-addit

Re: Is this a OneToOne or something else?

2008-02-12 Thread Hanne Moa
On Feb 12, 2008 2:58 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-02-12 at 14:51 +0100, Hanne Moa wrote: > > On Feb 12, 2008 2:23 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Tue, 2008-02-12 at 14:13 +0100, Hanne Moa wrote: &

Re: Is this a OneToOne or something else?

2008-02-12 Thread Hanne Moa
On Feb 12, 2008 1:56 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-02-12 at 13:36 +0100, Hanne Moa wrote: > > class Region(models.Model): > > id = models.IntegerField(unique=True, primary_key=True) > > region = models.CharField(max

Re: How popular is Django ?

2008-02-12 Thread Hanne Moa
On Feb 12, 2008 12:00 PM, tom <[EMAIL PROTECTED]> wrote: > How popular is Django among other Python Web Frameworks (TurboGears, > Pylons, Webware, CherryPy...) ? > > I found a link on the subject : > > http://www.therightsoft.com/softwaretechnologies/webframeworks Where's Drupal on this list? H

Re: Is this a OneToOne or something else?

2008-02-12 Thread Hanne Moa
On Feb 12, 2008 12:51 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-02-12 at 12:44 +0100, Hanne Moa wrote: > > On Feb 12, 2008 12:16 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Tue, 2008-02-12 at 12:11 +0100, Hanne Moa wrote: >

Re: Is this a OneToOne or something else?

2008-02-12 Thread Hanne Moa
On Feb 12, 2008 12:16 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-02-12 at 12:11 +0100, Hanne Moa wrote: > > Each org only has a single region, and in the old web-interface the > > region-data is shown as a drop-down-list () where you can > >

Is this a OneToOne or something else?

2008-02-12 Thread Hanne Moa
Just starting out with Django here... In an existing database whose existing table-structure must remain unchanged by django, I have several cases of what looks like a OneToOne, for instance: The table/class org has a field region which points to the id on the table/class region (dump from postg

Re: Is this a OneToOne or something else?

2008-02-12 Thread Hanne Moa
On Feb 12, 2008 2:23 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-02-12 at 14:13 +0100, Hanne Moa wrote: > > 1. how do I get "Region: 'someregion (somelocation)'" in the admin > > interface instead of "Region: '-

Where's HttpRequest?

2008-02-14 Thread Hanne Moa
I'm writing an authentication-backend and need to check if a cookie already exists. But: how do I get ahold of the HttpRequest? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gr

Problems with ManyToManyField

2008-02-15 Thread Hanne Moa
This model: http://dpaste.com/35309/ ... Being accessed through this authentication-backend while logging into the admin-interface: http://dpaste.com/35312/ ... Leads to this traceback: http://dpaste.com/35310/ Removing lines 18 to 22 in the middle paste fixes things. Now, all the renaming is d

Authentication-backend problem

2008-04-29 Thread Hanne Moa
I have a type of user that is logged in to the site in a way externally (SAML2-module for apache) to django (newest newforms-admin branch). This external login-process leaves a token in the environment-variables: while the token is in the envvars, the user is logged in. (I hope to write a SAML2 mo

Formwizard and dynamic initial data

2008-05-15 Thread Hanne Moa
Is Formwizard designed for new content only, or is it possible to use it for changing existing content? I haven't been able to find an obvious way to pass in run-time determined initial data anywhere, nor how to pass in an instance (for ModelForms). Have anyone found a way to pass in run-time ini

Re: moving from MySQL to PostgreSQL on a "live" site ..

2008-05-20 Thread Hanne Moa
On Tue, May 20, 2008 at 10:32 AM, oliver <[EMAIL PROTECTED]> wrote: > I take it doing via JSON you still need to convert the Boolean fields? > > would you know of any kind of scrip that would do it? as my editor > doenst cope to well with 7mb of xml files :(. > I guess its not to hard to write if

Re: Form wizard problem

2008-06-05 Thread Hanne Moa
On Wed, Jun 4, 2008 at 6:31 PM, tyman26 <[EMAIL PROTECTED]> wrote: > Unless I am really mistaken, I am pretty sure this is a bug. The > "self.step" variable in "wizard.py" is never being updated after the > forms are submitted. These are two possible fixes I found: This is a known bug already,

Re: how to get form fields to show

2008-06-26 Thread Hanne Moa
On Thu, Jun 26, 2008 at 11:07 PM, Bobby Roberts <[EMAIL PROTECTED]> wrote: > Ok i've got the form fields showing fine. My form action is "." per > the examples in the documentation. The form is submitting and tracing > through the view but i get a "view didn't return an > HttpResponse.objec

Where do ya'll put your glue models?

2012-04-14 Thread Hanne Moa
Say that there's an excellent 3rd party app "articles" with a model Article and another most excellent 3rd party app "polls" with a model Poll. How do you glue them together? If an Article may have several Polls and a Poll may be used in several Articles, you can glue them together with a new mode

Re: Where are the women?

2012-04-25 Thread Hanne Moa
On 24 April 2012 16:14, Daniele Procida wrote: > I was looking at again with excited > anticipation, and reading through the talk summaries. > > - and > then I had a closer look at the name

After python upgrade, User.objects.get(username= doesn't work consistently

2012-05-22 Thread Hanne Moa
I upgraded python to 2.6.8 today from an earlier 2.6, what an adventure! So much bizarre happenings so many places. Tonight's special: SomeModel.objects.get(sometextfield=sometext) always works (when there is one entry where sometextfield=sometext of course). auth.User.objects.get(username=somete

Re: After python upgrade, User.objects.get(username= doesn't work consistently

2012-05-22 Thread Hanne Moa
On 22 May 2012 22:58, Kurtis Mullins wrote: > Sorry I'm a bit confused so I'm going to try to make some sense of > your situation "out loud" :) > > 1. User.objects.get(username="some_username") works some-times Yes. > 2. When it doesn't work, then you get the DoesNotExist exception, right? Yes.

Re: After python upgrade, User.objects.get(username= doesn't work consistently

2012-05-23 Thread Hanne Moa
On 23 May 2012 00:30, akaariai wrote: > On May 22, 11:49 pm, Hanne Moa wrote: >> I upgraded python to 2.6.8 today from an earlier 2.6, what an >> adventure! So much bizarre happenings so many places. > > Please provide these three things for further debugging: >  - the e

How to add a ManyToManyField "dynamically" to a model?

2011-12-20 Thread Hanne Moa
I have some apps app1, app2, .. appN and a special app for metadata. The model metadata.Metadata should have ManyToManyFields to models (to primary key, nothing fancy) in some of the other apps. I don't want to have to update the models of the existing apps and the apps/models shouldn't be hard-cod

Re: How to add a ManyToManyField "dynamically" to a model?

2011-12-22 Thread Hanne Moa
On 20 December 2011 19:07, huseyin yilmaz wrote: > Generic forign key might help you I want to avoid Generic Foreign Keys as I don't like them much, philosophically speaking. I want something that is easier to work with from the SQL side of things. HM -- You received this message because you

Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
I can't get logging in with alternate auth backends to work with Django 1.4 or newer. Basically: 1. authenticate() works. request.user.is_authenticated() is True 2. Django's own login() seems to work, as request.user is set, request.session is set etc. 3. After the HttpResponseRedirect, request.u

Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
eady done and you can use it . Have no sense > to write it by yourself. > Many thanks, > > Serge > > > +380 636150445 > skype: skhohlov > > > On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa wrote: > > I can't get logging in with alternate auth backends to wor

Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
> > This is already done ! > > Take a look at > > > https://github.com/django/django/blob/master/django/contrib/auth/views.py > > > > login function is already done and you can use it . Have no sense > > to write it by yourself. > > Many thanks, > &

Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
On 14 October 2013 17:06, Tom Evans wrote: > On Mon, Oct 14, 2013 at 1:52 PM, Hanne Moa wrote: > > I can't get logging in with alternate auth backends to work with Django > 1.4 > > or newer. > > Are you sure sessions are working correctly? Are you setting cookie

Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-21 Thread Hanne Moa
Turns out: the auth backend that worked in 1.3 but not in 1.4+ was missing a get_user()-method. I added it in and that was that. HM -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from i

Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-11-11 Thread Hanne Moa
The fix that worked for 1.4.x did not work for 1.5.x. Only thing that worked for 1.5.x was changing how apache called django, by setting WSGIDaemonProcess to "processes=1" or removing "processes" entirely ("threads" can be lots more than one). Something has obviously changed in how django does wsg

Converting bytes to unicode that works both in python2 and 3

2015-05-19 Thread Hanne Moa
I got to start a new django 1.8-project in python 3.4 for once, and happily coded away. Turns out, the PaaS it needs to run on has a broken python 3.4, so... my code now needs to work in 2.7.8. Everything works in both versions except I need to read from an uploaded file, bot in the web and from t

Re: chemistry character set

2018-02-15 Thread Hanne Moa
On 2018-02-06 12:51, Mike Dewhirst wrote: > Thank you. I think this is where we probably need to go. I asked the > original question because I'm hoping the project will reach a tipping > point and start to accumulate a growing number of multilingual users. We > have our first multinational user but

Re: Verify Emails

2018-04-16 Thread Hanne Moa
If you do your own email-sending code you can break off the sending after the server sends "RCPT', that'll work regardless. On 7 April 2018 at 14:27, 'Anthony Flury' via Django users < django-users@googlegroups.com> wrote: > why not use an email validator provided by Django ? > > https://docs.dja

How to add AutoField to/switch out primary key for an existing table?

2016-11-29 Thread Hanne Moa
A model was designed with a wrong assumption of uniqueness and given a natural key. We now need to switch to a surrogate primary key. Upgrading Django is currently not an option. The production database may not be dropped/restored for this, it is in use by several unrelated projects (remember the t

Why are foreign keys rewritten when adding related_name?

2019-02-28 Thread Hanne Moa
I added "related_name" to an exiting ForeignKey and checked with "django-admin sqlmigrate" what would be done. It seems that the foreign key constraint is dropped, then the exact same constraint is added back. Why? Example: If we have the classes: class Wall(models.Model): .. class Door(models.

Re: Why are foreign keys rewritten when adding related_name?

2019-03-04 Thread Hanne Moa
No, 1.11. This project is still on Python 2.7 but I do think we'll have it on Python 3(.5) before the year is over. On Fri, 1 Mar 2019 at 21:16, Simon Charette wrote: > > Hello HM, > > I know that some changes have been made to avoid unnecessary foreign key > rebuilds on some option changes. > >

How to discover which postgres vesion is in use (on 1.11)?

2017-07-19 Thread Hanne Moa
When https://code.djangoproject.com/ticket/18332 lands (No generic way to get database backend version) this will be trivial but I need a solution for this now: How can I find out which version of postgres is in use? I need it thanks to JSONField. 9.6 has support for it but older postgresqls don't

Upgrading from Django 1.7: render_to_response and context_instance

2018-08-08 Thread Hanne Moa
I'm upgrading a rather large code base from django 1.7, with the ultimate goal to have it run on 1.11, as the code isn't fully verified to run on python 3 yet. I'm replacing `render_to_response()` with `render()` everywhere a RequestContext is used, and came upon this (simplified) oddity: return

Re: Upgrading from Django 1.7: render_to_response and context_instance

2018-08-08 Thread Hanne Moa
plate.context_processors.static', > 'django.template.context_processors.tz', > 'django.contrib.messages.context_processors.messages', > 'django.template.context_processors.request', > 'general.context_processors.extra_context', >