Re: get_absolute_url() necessary with ModelForm ?

2019-07-07 Thread Axel Rau
> Am 06.07.2019 um 18:28 schrieb Daniel Roseman : > >> On Thursday, 4 July 2019 18:45:47 UTC+1, axe...@chaos1.de wrote: >> I’m using a model in 2 apps with different urls. >> Subclasing it and overwriting get_absolute_url() did not work, >> because it mangled dbtable. >> UpdateView does not

get_absolute_url() necessary with ModelForm ?

2019-07-04 Thread Axel Rau
I’m using a model in 2 apps with different urls. Subclasing it and overwriting get_absolute_url() did not work, because it mangled dbtable. UpdateView does not work with ModelForm w/o get_absolute_url(). Does there any workaround exist? Thanks, Axel --- PGP-Key: CDE74120 ☀ computing @ chaos

Re: --fake-initial does not follow PostgreSQL search_path schema list

2019-06-11 Thread Axel Rau
This worked with Django 2.1. Seems to be a bug in 2.2 Axel > Am 08.06.2019 um 21:50 schrieb Axel Rau : > > The database user sets a search_path to a,b > In schema b exists a set of tables corresponding to models and > inital_migration. > Running > migra

--fake-initial does not follow PostgreSQL search_path schema list

2019-06-08 Thread Axel Rau
The database user sets a search_path to a,b In schema b exists a set of tables corresponding to models and inital_migration. Running migrate --fake-initial app inital_migration recreates all table in schema a. Documentation says "--fake-initial does nothing if tables already exist. Is

Re: state_operations while adding 2 fields

2019-05-31 Thread Axel Rau
> Am 31.05.2019 um 13:15 schrieb Axel Rau : > > is it posible to bundle 2 AddField migrations with one RunPython? > How should I arrange the state_operations in this case? > > The following migration does not work. It seems, the variant below does the job. However there is

state_operations while adding 2 fields

2019-05-31 Thread Axel Rau
Hi all, is it posible to bundle 2 AddField migrations with one RunPython? How should I arrange the state_operations in this case? The following migration does not work. Please advice, Axel def forwards_func(apps, schema_editor): with connections['erdb_migration'].cursor() as cursor:

2.2a1: django-admin migrate throws UnicodeEncodeError

2019-02-01 Thread Axel Rau
Hi, File "/usr/local/py_venv/erdb2-django/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 266, in migration_progress_callback self.stdout.write(" Applying %s\u2026" % migration, ending="") File

Re: 2.1b1: Getting "unexpected keyword argument 'limit_choices_to'"

2018-07-05 Thread Axel Rau
Thanks Markus for the hint. f3fa86a fixed the problem. > Am 04.07.2018 um 17:11 schrieb Markus Holtermann >: > > Thanks for the report Axel. This seems to be the same issue as the one > reported in https://code.djangoproject.com/ticket/29449 >

2.1b1: Getting "unexpected keyword argument 'limit_choices_to'"

2018-07-04 Thread Axel Rau
Hi, I tried 2.1b1 with my 2.0.6 project and at got this error on startup: —- (erdb_d2.1+p3.6) axels-imac:ERDB2 ajr$ django-admin check /usr/local/py_env/erdb_d2.1+p3.6/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8;

Re: 1.11: Value error on related user name during save of user model

2017-09-14 Thread Axel Rau
> Am 21.08.2017 um 23:53 schrieb James Schneider : > > If this was working under 1.9 (I'd be surprised if it was), then I would file > this as a backward-incompatibility bug with the bug tracker. https://code.djangoproject.com/ticket/28594 Axel ---

Re: 1.11: Value error on related user name during save of user model

2017-08-22 Thread Axel Rau
Thanks for taking the time to write such an extensive answer. > Am 21.08.2017 um 23:53 schrieb James Schneider <jrschneide...@gmail.com>: > > > > On Mon, Aug 21, 2017 at 7:50 AM, Axel Rau <axel@chaos1.de > <mailto:axel@chaos1.de>> wrote

1.11: Value error on related user name during save of user model

2017-08-21 Thread Axel Rau
While upgrading from 1.9 to 1.11, ForwardManyToOneDescriptor.__set__() tries to assign a string (description of the related instance) to the related user name field of user model. class AbstractEmailUser(AbstractBaseUser, PermissionsMixin, FieldlistForDetailTemplateMixin): localemail =

Re: static files not found on development server

2017-07-06 Thread Axel Rau
> Am 06.07.2017 um 11:44 schrieb Melvyn Sopacua : > > On development, you're running a webserver that doesn't know the `/static` > url or failed to run `python manage.py collectstatic`. On development, I run the django-admin runserver, which AFAIK should take care of the

static files not found on development server

2017-07-06 Thread Axel Rau
Hi, I can’t find the answer to this simple question: Why do I get [06/Jul/2017 09:54:20] "GET /static/css/bootstrap.min.css HTTP/1.1" 404 1676 on development server, while on production server, it works. In production, I have On development, I have tried this and this:

obtaining related object from django.db.models.fields.related.ForeignKey

2016-04-02 Thread Axel Rau
Hi all, from a model object, I can get a related object shortcut, using the name of the foreign key field: >>> m1 = Mailbox.objects.get(pk=38) >>> str(m1.localdomainfk) 'framailx.de' But if I have the foreign key field instead of its name, I can only get the pk of the related object: >>> f1 =

makemigrations of model with single table inheritance and child fields

2015-12-22 Thread Axel Rau
Hi all, My db, which is in production (with none-Django software) has some (legacy) tables, which share a set of common fields and some fields, which differ by child. The attached single table model hierarchy worked for me, even if it’s not a legal Django arrangement. The ’type’ field is

[RESOLVED] --was: Re: application not recognized as URL namespace

2015-12-14 Thread Axel Rau
I see my error: ’auth’ is already an appname (django.contrib.auth). Using ’accnt’ works perfectly! Thanks, again, Axel > Am 14.12.2015 um 16:32 schrieb Axel Rau <axel@chaos1.de>: > > >> Am 14.12.2015 um 16:03 schrieb knbk <marten.k...@gmail.com >>

Re: application not recognized as URL namespace

2015-12-14 Thread Axel Rau
> Am 14.12.2015 um 16:03 schrieb knbk : > > authentication/urls.py: > > from django.conf.urls import url > from . import views > > app_name = 'authentication' > > I thought you didn’t have an app_name, but you do have one. I changed this after your advice. > In that

Re: application not recognized as URL namespace

2015-12-14 Thread Axel Rau
> Am 14.12.2015 um 15:29 schrieb knbk : > > Could you show your full root urls.py and authentication/urls.py? urls.py: from django.conf.urls import include, url from django.views.generic import TemplateView # Uncomment the next two lines to enable the admin: from

Re: application not recognized as URL namespace

2015-12-14 Thread Axel Rau
Thanks for taking the time, > Am 14.12.2015 um 14:06 schrieb knbk : > > Hi Axel, > > An installed application and a registered URL namespace are two distinct > concepts. A URL namespace can only be defined by setting the app_name > attribute in your urlconf. In this

application not recognized as URL namespace

2015-12-14 Thread Axel Rau
In my root url, I have: url(r'^authentication/', include('authentication.urls')), in authentication/urls.py, I have no app_name declared. In a module in authentication, I have from django.core.urlresolvers import reverse from django.apps import apps

Re: How do I let forms.models.ModelChoiceField.queryset relate on request.user?

2015-11-18 Thread Axel Rau
> Am 18.11.2015 um 15:28 schrieb 'Tom Evans' via Django users > : > > modelform_factory takes many arguments, one of which is for the base > form class to use. You can provide a different base class from the > default ModelForm, make sure to derive the new base

Re: How do I let forms.models.ModelChoiceField.queryset relate on request.user?

2015-11-17 Thread Axel Rau
ds if f.name == formfield_name] qs = userVisibleFilterQS( self.request.user.pk, False, modelfield.related_model()) if qs: formfield.queryset = formfield.queryset.filter(qs) Am 16.11.2015 u

Re: How do I let forms.models.ModelChoiceField.queryset relate on request.user?

2015-11-16 Thread Axel Rau
eter, modify the choicefield > queryset, and then call the original constructor of the form. > > On Sun, Nov 1, 2015 at 3:50 PM, Axel Rau <axel@chaos1.de> wrote: > User should see only choices related to him in a ModelChoiceField. > Do I need a fresh form per request?

Re: How do I let forms.models.ModelChoiceField.queryset relate on request.user?

2015-11-04 Thread Axel Rau
hen call the original constructor of the form. > > On Sun, Nov 1, 2015 at 3:50 PM, Axel Rau <axel@chaos1.de> wrote: > User should see only choices related to him in a ModelChoiceField. > Do I need a fresh form per request? > What would be the best approach? > > Thank

How do I let forms.models.ModelChoiceField.queryset relate on request.user?

2015-11-01 Thread Axel Rau
User should see only choices related to him in a ModelChoiceField. Do I need a fresh form per request? What would be the best approach? Thanks, Axel --- PGP-Key:29E99DD6 ☀ +49 160 9945 7889 ☀ computing @ chaos claudius -- You received this message because you are subscribed to the Google

Re: Popen works on system but fails on Django

2013-04-29 Thread Axel Rau
Am 28.04.2013 um 21:47 schrieb gtp...@gmail.com: > OSX 10.7.5, System Python 2.7.1, Django 1.5.1 > > In system Python shell: > > from subprocess import Popen Popen("open /Library/Application\ > Support/blender.app", shell=True) > > will open blender. > > Django views.py Popen("open

Re: template for "Pagination for admin inlines" snippet

2013-02-06 Thread Axel Rau
Am 05.02.2013 um 22:16 schrieb Conor Pollock: > I'm currently trying to figure this out as well... I can pass a page query > in the url and everything works as expected, but I can't figure out how to > render the pagination controls in my template file. > > Did you ever get this to work? No,

Re: Append [RESOLVED] to your post subject if you got to a working solution

2012-12-26 Thread Axel Rau
Am 25.12.2012 um 09:51 schrieb Avraham Serour: > I oppose adding [RESOLVED] to the subject, this means changing the subject > to a complete different string and detaching it from the thread. MUAs like Apple Mail or Thunderbird use "references" header (if present) instead of "subject" for

Re: Obtaining related model name during form creation

2012-12-05 Thread Axel Rau
Am 05.12.2012 um 11:23 schrieb Axel Rau: > In __init__ in my form class I have: > > for name, field in self.fields.items(): > model_field = self.instance._meta.get_field_by_name(name)[0] > if isinstance(field, forms.models.ModelChoiceField):# foreign key &g

Obtaining related model name during form creation

2012-12-05 Thread Axel Rau
In __init__ in my form class I have: for name, field in self.fields.items(): model_field = self.instance._meta.get_field_by_name(name)[0] if isinstance(field, forms.models.ModelChoiceField):# foreign key x = getattr(self.instance, name, '')#

Re: Obtaining field name in template

2012-11-13 Thread Axel Rau
Am 12.11.2012 um 22:59 schrieb Lachlan Musicman: > On Tue, Nov 13, 2012 at 9:51 AM, Axel Rau <axel@chaos1.de> wrote: >> 1st trial with generic views: >> >> url.py: >>url(r'^account/(?P\d+)/$', AccountDetailView.as_view(), >> name='acco

Obtaining field name in template

2012-11-12 Thread Axel Rau
1st trial with generic views: url.py: url(r'^account/(?P\d+)/$', AccountDetailView.as_view(), name='account-detail'), views.py: class AccountDetailView(DetailView): model = Account In the template, I get the data so: object.field But how do I get the field name

template for "Pagination for admin inlines" snippet

2012-10-08 Thread Axel Rau
Hi, anybody got a template working for this https://gist.github.com/559911 ? I have no idea how to fiddle it into the admin template system. Thanks, Axel --- PGP-Key:29E99DD6 ☀ +49 151 2300 9283 ☀ computing @ chaos claudius -- You received this message because you are subscribed to

[RESOLVED]: Re: Search/Lookup of raw_id_field in inline

2012-09-18 Thread Axel Rau
Am 18.09.2012 um 12:19 schrieb Axel Rau: > I have this inline: > --- > class LocallistentryInline(TabularInline): >model = Locallistentry >extra = 1 >raw_id_fields = ('relaynetfk', 'relayhostfk', 'mailrelationfk', > 'senderdomainfk') >exclude =

Search/Lookup of raw_id_field in inline

2012-09-18 Thread Axel Rau
I have this inline: --- class LocallistentryInline(TabularInline): model = Locallistentry extra = 1 raw_id_fields = ('relaynetfk', 'relayhostfk', 'mailrelationfk', 'senderdomainfk') exclude = ('remarks', ) class LocallistAdmin(ModelAdmin): inlines = [LocallistentryInline, ]

Re: Dealing with big changelists in admin

2012-09-12 Thread Axel Rau
Am 12.09.2012 um 16:20 schrieb Stephen Anto: > Hi, > > Pls refer this link <http://f2finterview.com/web/Django/15/> > http://f2finterview.com/web/Django/15/ it may give you solution Any hint, how to integrate this into the admin? > > On Wed, Sep 12, 2012 at 5:31 PM, A

Re: Dealing with big changelists in admin

2012-09-12 Thread Axel Rau
_empty_first_page=True): >>super(OneShotPaginator, self).__init__(object_list[:20], per_page, >> orphans, allow_empty_first_page) >> --- >> This did not reduce the number of displayed rows to 20. >> Only the summary count at the botton is now 20. )-8 >> Any

Re: Dealing with big changelists in admin

2012-09-12 Thread Axel Rau
ty_first_page=True): super(OneShotPaginator, self).__init__(object_list[:20], per_page, orphans, allow_empty_first_page) --- This did not reduce the number of displayed rows to 20. Only the summary count at the botton is now 20. )-8 Any glue? > > On Wed, Sep 12, 2012 at 1:44 PM, Axel Rau &l

Dealing with big changelists in admin

2012-09-12 Thread Axel Rau
I have a table with lots of IP addresses. I defined some search_fields and that works well. How can I limit the amount of fetched and displayed rows (and pages)? A filter which slices the QuerySet to display only the first 100 results, would do it, but I do not know, how to create a filter, which

Re: Django & postgresql arrayfield support + filtering objects based on array contents

2012-09-03 Thread Axel Rau
Am 03.09.2012 um 14:15 schrieb zayatzz: > But since django does not offer postgresql arrayfields support Jonathan S. Katz implemented a library of Django extensions for PosgreSQL and wrote an excellent presentation: http://wiki.postgresql.org/images/e/e6/Django-extensions.pdf

Re: expand fieldset by choice

2012-08-28 Thread Axel Rau
Am 28.08.2012 um 15:35 schrieb Melvyn Sopacua: Another question: How can I expand the right fieldset dependent of current content of my choices field (as loaded from db) while rendering the change page initially? >>> >>> Look in django/contrib/admin/options.py for

Re: expand fieldset by choice

2012-08-28 Thread Axel Rau
Am 28.08.2012 um 00:13 schrieb Melvyn Sopacua: >> >> Another question: How can I expand the right fieldset dependent of >> current content of my choices field (as loaded from db) while >> rendering the change page initially? > > Look in django/contrib/admin/options.py for get_fieldsets(). Also

Re: expand fieldset by choice

2012-08-27 Thread Axel Rau
Am 27.08.2012 um 17:22 schrieb Dennis Lee Bieber: > If Javascript (and by extension, AJAX) is not a viable option, it > would seem that you will be stuck with having the first choice made > trigger a form submittal so that the server can then populate the second > part and send it back to

Re: expand fieldset by choice

2012-08-27 Thread Axel Rau
Am 27.08.2012 um 15:04 schrieb Nicolas Emiliani: > > Through JS, you need to implement a script that binds to the change event > and then changes the collapse css call for the specific div. You may want > to look > at jQuery, although this is out of scope of the list. > > Once you have your

Re: expand fieldset by choice

2012-08-27 Thread Axel Rau
Sun, Aug 26, 2012 at 5:03 PM, Axel Rau <axel@chaos1.de> wrote: > >> In my admin site, I have a fieldset which depends on a choice. >> I would like to control expansion of the related fieldset by the choice >> instead of the standard widgets. >> How can I do this?

expand fieldset by choice

2012-08-26 Thread Axel Rau
In my admin site, I have a fieldset which depends on a choice. I would like to control expansion of the related fieldset by the choice instead of the standard widgets. How can I do this? Axel --- PGP-Key:29E99DD6 ☀ +49 151 2300 9283 ☀ computing @ chaos claudius -- You received this message

Re: New to dj: relational limitations

2012-08-19 Thread Axel Rau
Am 15.08.2012 um 01:49 schrieb Russell Keith-Magee: > For example, in order for the admin to allow > for an "empty" input, you'll need to set the field as 'blank=True', > which means the NULL will be converted to a blank string. > > This could be addressed at the form level, but it will involve

Re: New to dj: relational limitations

2012-08-15 Thread Axel Rau
Am 15.08.2012 um 01:49 schrieb Russell Keith-Magee: > This SQL "Standard" of which you speak… do you know of anyone that > implements it? :-) Yes. Look here: http://www.postgresql.org/docs/9.1/static/features.html At a minimum, I expect such a conformance list from a vendor. > > Python

New to dj: relational limitations

2012-08-14 Thread Axel Rau
Hi, I'm starting to investigate django while designing a web GUI for an already productive DB. 3 applications are currently maintaining the DB contents, one of them is a real-time app (email server), others are periodic background tasks. ERM is the central design method