tags:

views:

15

answers:

1

Hello, I am developing a django project for auctions. I want to add the following functionality:

A registered and logged in user must add a product (I have accomplished registration and authentication). When this user clicks some /add/product/ or whatever link, I need to fetch the very admin-add-product template-interface (redirect maybe?), so that he adds a product as if he was admin.

How can I accomplish this?

I assume that a preliminary work/condition must be that when a user is registering, in some way he must automatically be granted the permission of adding products. So, how can this be done also?

A: 

The admin's not really designed for end-user-facing stuff. See the penultimate section of the http://www.djangobook.com/en/2.0/chapter06/ The section before that on the same page ("Users, Groups, and Permissions") goes into a little detail about default permissions, etc. More detail is here http://docs.djangoproject.com/en/dev/topics/auth/#groups

If it's ok for them to see and use the admin, you could mark the relevant Users as staff and then create a permission group that allows them to add edit and delete Product objects then add the relevant User(s) to it.

That'll do what you need without writing any additional code - just some clicking around in the admin.

If, however, you want your end user to have a styled and ultimately bespoke view that lets them add a product, you'll have to write your own views to handle it. See http://www.djangobook.com/en/2.0/chapter07/ for starters

stevejalim