Dynamicly preset forms in the admin interface
Hello, I'm new to django, so this question may look a bit stupid, but I couldn't find the information in the documentation. I have a pretty simple model which looks like this: class article(models.Model): headline = models.CharField(max_length=140) newsentry = models.TextField() pub_date = models.DateTimeField('date published', null=True, blank=True) write_date = models.DateTimeField('started writing') published = models.BooleanField() author = models.CharField(max_length=20) What i want to do now, is that some of these fields are preset when a new article is written. Lets say a user named Peter is going to write a new article, then the author field should be preset to "Peter" and shouldn't be editable. Same thing for write_date, which should be set to the time Peter started to write this article. How do I do this? Greets, Kai -- 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 from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Dynamicly preset forms in the admin interface
2009/11/29 rebus_ : > Have you tried using fieldsets [1] in you ModelAdmin. Also you can > override save_model method on the ModelAdmin to set values for some > object attributes when the object is being saved [2]. I don't see how I can use fieldsets to achieve this. I thought with the fieldsets I just tell django what forms to show in the interface, but not what to put in it. And when I overwrite the save_model method, there is no way to show the user what will end up in the database, right? So that is not the right way when I want to have the user to have the opportunity, to change the default data. Greets, -- Kai Timmer | http://kaitimmer.de Email : em...@kaitimmer.de Jabber (Google Talk): k...@kait.de -- 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 from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Dynamicly preset forms in the admin interface
2009/11/29 rebus_ : > I imagine some of core devs or django gurus would maybe have better > ideas on how to do this (or can even tell you if this is documented > somewhere). What i wonder is: Isn't this a fairly common thing? I could think of so many situations where you would preset fields with values from the database. So I am pretty suprised that it seems like there is no "default" way of doing this. This maybe because i never used a framework like django before and I'm missing a general design principle. If so, please tell me ;) > As far as readonly fields go i found snippet [3] but i haven't look at > it closely to tell you is it any good or not. > But if you set your fields read only how would you make them editable > if necessary? With JavaScript? It is more like the fields should be either preset and editable XOR preset and not editable. Nothing to change there once the page is rendered > Hope i helped this time :) Too much Information :) I'm just getting started with django ;) Greets, -- Kai Timmer | http://kaitimmer.de Email : em...@kaitimmer.de Jabber (Google Talk): k...@kait.de -- 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 from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Dynamicly preset forms in the admin interface
2009/12/1 rebus_ : > I hope this casts some light on what i am trying to say. > Anyway, the best way is to read docs and look in django code. Sorry i > can't help more. You helped a lot. Thank you. Greets, -- Kai Timmer | http://kaitimmer.de Email : em...@kaitimmer.de Jabber (Google Talk): k...@kait.de -- 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 from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Show additional user information in admin
Hello, by following this guide: http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users I made a model and added some information to every user. What do I have to do, to show these additional fields in the admin/user interface? Greetings, -- Kai Timmer | http://kaitimmer.de Email : em...@kaitimmer.de Jabber (Google Talk): k...@kait.de -- 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 from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Show additional user information in admin
2009/12/2 aa56280 : > You'll have to "activate" the model like any other in order for it to > show up on the Admin site. Ok, but then I have an extra entry for my UserProfile Model in the admin Interface. That works, but it would be nice to see and edit the entrys in UserProfile directly via admin/auth/user. From my novice standpoint, it looks like i have to overwrite the default admin.py from the auth module. Is that right? And if yes, how do I do it "the right way"? Thanks for your help, -- Kai Timmer | http://kaitimmer.de Email : em...@kaitimmer.de Jabber (Google Talk): k...@kait.de -- 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 from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Show additional user information in admin
2009/12/3 bax...@gretschpages.com : > How, exactly? I tried this, with no luck: I can't get it working too. Can someone please provide a simple example? That would be really great. Greetings, -- Kai Timmer | http://kaitimmer.de Email : em...@kaitimmer.de Jabber (Google Talk): k...@kait.de -- 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 from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Show additional user information in admin
2009/12/3 Matt Schinckel : > I have an app called person which has my UserProfile in it: Now I got it. Thank you. Greetings, -- Kai Timmer | http://kaitimmer.de Email : em...@kaitimmer.de Jabber (Google Talk): k...@kait.de -- 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 from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Connecting a django-registration signal to a function
Hello, this may sound stupid, but all I want to do is to connect the user_activated signal from django-registration to a simple function. And I think that I missed an important part. I have a signals.py file in my django app with a function create_db which is defined like this: def create_db(sender, user, request ): [...] and a line: user_activated.send(create_db) The last line gets called with no error, so I think that the signal is connected, but when a user is activated (by clicking on the activation link), the function is not called. Whats the problem here? -- 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 from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Connecting a django-registration signal to a function
On 23 Aug., 16:51, Kai Timmer wrote: > Whats the problem here? Really? Is no one able to point me in the right direction here? Or is the question just to stupid? -- 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 from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.