Re: Non-primary auto-incrementing field with Postgres

2017-06-21 Thread thauk
On Tuesday, June 20, 2017 at 10:40:05 PM UTC-7, Scot Hacker wrote: > > One strategy might be to: > > 1) Bring in the data under a different column name ('old_id' ?) > 2) In a single migration, drop the default ID column, rename old_id to > id, and give it primary_key=True > I can't change the p

Testing a Django library

2017-03-20 Thread thauk
I am working on a Django library (which will be packaged) and want to set up testing for it. Looking at a number of existing Django libraries, here seem to be a number of ways to set up testing, and all of them are different. Are there any best practices? Is there a guide that specifies how it

Re: ModelAdmin missing a couple of key features, or am I doing this wrong?

2016-09-16 Thread thauk
Apologies, I updated it. class MyModelAdmin(ModelAdmin): model = MyModel form = MyForm def get_form(self, request, obj=None, **kwargs): form_class = super(MyModelAdmin, self).get_form(request, obj=obj, **kwargs) some_parameter_for_one_thing = self.get_some_parame

Re: ModelAdmin missing a couple of key features, or am I doing this wrong?

2016-09-15 Thread thauk
I just realized that get_form is already passed the model instance as obj, so that fixes getting he model instance (for this method at least -- hopefully I don't need to override another method that doesn't get obj). Still need a better way to customize how a form instance is initialized, thoug

Re: ModelAdmin missing a couple of key features, or am I doing this wrong?

2016-09-15 Thread thauk
I'm having trouble finding any related tickets other than this one, which is 8 years old: https://code.djangoproject.com/ticket/10305 On Thursday, September 15, 2016 at 5:34:50 PM UTC-7, Tim Graham wrote: > > I think these ideas have been floated before. If you look through the Trac > tickets y

Re: ModelAdmin missing a couple of key features, or am I doing this wrong?

2016-09-15 Thread thauk
Hi Tim, thanks for the reply :) It's not that I want to store the model instance on self.instance, it's just the solution I was able to come up with, given the problem "I need to get to the model instance for this HTTP request". If there's a better way to do it, I'm all ears! T On Thursday, S

ModelAdmin missing a couple of key features, or am I doing this wrong?

2016-09-15 Thread thauk
I have a ModelAdmin subclass (code at: ) and I need to do a couple of things, but the functionality seems to be missing: 1. I need to access the model instance to perform some initialization, but there's no instance member set. There are a few questions on Stack Overflow

Loading fixtures inside a transaction

2016-08-03 Thread thauk
Is it possible to have the `loaddata` manage command use a transaction when loading a fixture? -- 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 it, send an email to django-users+unsu