I have recently started learning Python & Django. I have gone through the Django tutorial twice now and am beginning to feel comfortable with its contents.
My goal is to make an app pretty much like the Django "Admin" site. What I am unsure about is how to go about it in the most efficient way.
Based on what I have learned from the tutorials I have had a go at making my app and am successfully displaying readonly data.
What I would like to do now is give users the ability to modify the data themselves, create new records etc etc, pretty much exactly the same way that the "admin" site works. Is there a shortcut way of implementing this, versus coding it all myself?
As the "admin" interface was built automatically to suit my model, i figure it should be possible to do something similar for the user facing side of the app without having to recode it all?
Any help greatly appreciated!
cheers
James (python & django newbie)
Thanks for the responses. To summarise them:
No, there is not a quick way to generate something similar to "admin" in the user side of an app.
You can extend/mod the "admin" side to your requirements, and give users access to this area (customise the permissions for this).
Related
I am building an e-commerce website and I would like to customize my Django Admin Panel to look something like this:
I would like to re-design the entire admin page and add graphs, tables images etc. the same way you would do on the front-end. I have been searching online for hours for a solution but I can't find anything useful. Does anyone have any solution to this problem?
The django-admin pages can be customised, but not to the extent that you are hoping for. You would need to over-write a whole load of the built in django admin views, re-write a lot of the templates too.
By this point you would be re-writing so much of it, you would basically be writing your own admin anyway, and so it would be much much easier, not to use the admin app at all, and just write your own admin interface from scratch. From the docs:
The admin has many hooks for customization, but beware of trying to
use those hooks exclusively. If you need to provide a more
process-centric interface that abstracts away the implementation
details of database tables and fields, then it’s probably time to
write your own views.
Remember also, that the admin app is not designed to be a production ready interface. It should ideally, only be used by developers, so if you are needing something to be used by a wider group, the admin app probably isn't appropriate anyway.
Sorry that this probably isn't the answer you were hoping for, but it will definitely be much easier to do this yourself, than try and bolt it onto something that is going to get in your way every step of the way.
It's been a while since I last used Django for a project and there have been some really great advances in the core project and the ecosystem around it.
One of those is the mature API development libraries like django-rest-framework.
So far I'm loving it. But it seems that all the guides I've found are disabling the Django Admin when using Django Rest Framework.
The reasons I've seen given were essentially "We don't need it for anything" or "We aren't using sessions, which Admin uses, so it won't work, so we're not using it."
"Don't need it" is a valid reason.
But other than that, are there reasons that it's bad practice to keep the Django Admin enabled when the project is primarily used as an API?
For my purposes, I find it convenient to manage user permissions and as a simple way to code admin only functions for dealing with the underlying data.
note: I've considered whether this question is designed to elicit opinions, which is not appropriate on SO. I believe that the answers I'm asking for will be technical or security based reasons with fact or experience based reasoning.
Totally agree.
On my current project, users are getting and setting ALL data via django-rest-framework.
Like you, I find the admin site convenient to manage user permissions, permissions groups, writing emails, sms, mobile applications push and more.
More, all these models are being translated, and translation is set in THE ADMIN SITE !!!
So, if we need a new object with translation, we do not need a new app release (example in pic of a question).
objects translations are readable and clear.
Data is organized nicely with minimal effort.
Admin get cool skins (jet / grappelli etc etc)
Language activation works like a charm in the APIViews.
Im doing development in Rails that requires a good bit of friendly hand off to the client. For a bit, I have used Active Admin and out of the box it seems to work for the use cases I have run into like CRUD actions on model resources. However, a new app I am building involves the the ability for the client to essentially edit everything on the website and add new pages. It seems that I could get Active Admin to do this but it would take an incredibly long time. So, here are my thoughts: Try and extend Active Admin and see where that goes, build a CMS from scratch and wrap it around an Admin namespace or something similar, or see if there is a more robust CMS (does not have to be free), that comes with rich features, i.e. templating, new page creation, wyswig editor, rich text editor, etc. Think more Wordpress style CMS. What are your guys thoughts? Thanks everyone!
I can recommend this CMS, worked with it for some years now.
I am trying to create a portal.
The portal should allow multiple user logins. The users are customers and upon login they should be able to check their sales, repository and stuff like that. Users won't need to be post blog, or anything like that, just simple checking of their daily sales.
As the admin, i, of course, should be able to edit all accounts.
I am contemplating to use a CMS such as Drupal, unless there is no such solutions, maybe a framework such as RoR would work too.
My question is, which open source CMS/framework should I use?
I would recommend you try Drupal because you can create your sales and repository info as "content". If it's suitable it would be much more productive and less error-prone than coding up something from scratch.
A common misconception of Drupal is that it is only suited for editorial written content like blog posts or articles. By using CCK and views you can quickly set up some CRUD functionality and more.
Here's a nice intro to CCK.
That sounds like pretty standard requirements for a extranet site, django or RoR seem a obvious choice. CMS's like Drupal, django-cms, Plone etc. are more concerned with content such as texts.
Choose your tool according to your current skills. I myself prefer django, but RoR will be better if you already know ruby.
CMS won't suit you because they are basically designed for managing content. Your requirements seem to far simple from that. If you are familiar with python, you can do such a site in 20 mins using Django.
I have no experience with Ruby of RoR!
Im still fairly new to Django, so please explain things with that in
mind.
I'm trying to create three websites using 2 subdomains and 1 domain:
for the blog, blog.mysite.com
for the forums, forums.mysite.com
for the custom web app, mysite.com
When building the custom web app, I used contrib.auth to make use of
the built-in django provided user models and functionality.
For the forums, I am planning on using SNAPboard (http://
code.google.com/p/snapboard/) with minimal, if any, modifications. On
initial inspection, it looks like it also uses contrib.auth users.
For the blog, I will probably be rolling my own lightweight blogging
app (since that seems to be the Django way and, also, b/c as Bennet
mentions, there is no killer Django Blog app)
Currently, I am considering two features that require some integration
between the three sites. First, I want to have the users of the custom
web app to use the same account to also log into the forums. Second, I
also (but I haven't figured out how I'm going to do this yet) would
like my blog posts to automatically become a topic for discussion in
the forums (this is just an idea I had, I might end up dropping it).
Ok, so to my questions:
1) Again, I'm new to Django, but this integration leads me to believe
the three websites need to be all under one project. Is this correct?
2) How would I accomplish the url structure for the websites that I
described above (blog.mysite.com, etc)? In the project's urls.py, I
don't know how to filter off of subdomains. If it was mysite.com/
forums/, that would be easy, but I don't know how to to catch
forums.mysite.com and forward it to the appropriate Django app.
3) Would I have to make use of the django.contrib.sites framework? I
don't understand that framework fully, but it seems like it's used
when two different websites are using the same django app in the
background. Whereas my three websites are all using different django
apps, but I want them to share a little bit of data.
Thanks for your help.
1) Yes, it's only true way for that
2) Use middleware
3) No, you don't need it.