Adding custom data to Django's admin dashboard - django

I'm having a bit of trouble with Django again.
I have a simple e-commerce website project that I'm working on for my graduation. It sells books. I've got basic functionalities down, such as adding categories and products, client sign-ups and logins, a session-based shopping cart, a checkout page fully connected to a payment API, and an orders model to keep track of data.
My professor has asked me now to to add relevant reports in the Admin panel, talked to me a while about what would be relevant to see and all. So, I've got in mind what I'm hoping to make.
I want to have two containers in the main dashboard page, which would display some quick analytics (like, how many books the store has sold in the past seven days, how much money from sales the site has made in the past month), as well as links in the sidebar: I want each relevant app within my project to have their own reports section in the Admin panel, maybe led to from a link underneath their models. I've separated the storefront, accounts, orders, shopping cart, and checkout, for instance, in different apps
The problem is I can't really figure out how to actually... do that...
I've fiddled with the layout and templates on the admin; I've figured out how to add custom links to the admin page, and change its design elements, for instance. But I'm not sure how to link the data I want to the dashboard. It feels like the answer is right in front of me and I can't reach it...
I guess my question is, how can I add my reports to the Django admin page per app, and how can I add these containers that I want in the dashboard?
I've guessed that I have to start out by building a view for each report. So I am currently reading the Django docs on the Admin page again, as well as looking at questions similar to mine.
But any information y'all can share that could ease up this process and save me some time would be very much appreciated. Thanks so much!
PS: If it helps, I am overriding the admin templates by having all the .html pages copied on my project's templates folder - it's how I got it to display the store's header in the admin dashboard.

Related

How to develop a button for followers of a web site

I apologize for my English it is not very good.
I am developing a website that will have own followers.
I need to create a button by followers such as facebook, twitter or google plus buttons.
Thank you for any information that will allow me to begin to develop the button next to the platform.
Thank you
First, your English is fair enough. For creating your own follow button you will have to have an image that will be displayed on your website. When someone clicks on that button, your webapp should be able to know who clicked it and your should be able to remember that user in future as well. So first you will have users to register on your website (like facebook and twitter) for unique identification of each user.
Next, for remembering that a particular user is following your website you need to persist some information about that user. The obvious approach is having a database table to store the information. For instance you can have IS_FOLLOWING column in your USER table
But there are some considerations. First, the user must remain on the same page or be able to continue his activity even after cicking the follow button. For example, if the user is filling some form then his data should remain intact even after clicking the follow button. If the user is directed to some other page, he might lose information.
Second, database operations are costly. So you need to use them wisely.
One approach that I could think of is having AJAX do the work. If you want to learn AJAX you can visit this website and for AJAX database operations this one will be helpful.
Ajax will do all the work in background and both the problems mentioned above will be addressed. I hope this was helpful.

programatically creating django zinnia blog entries for non-admin users

For a website that is using django zinnia blog, I need the possibility to, beyond authors using the admin to create articles, to have a limited way for non-admin users to create blog entries, in their own specific area, with limited functionality (e.g. preset category, all entries start as draft etc..)
Now I was wondering if I could just create an own small ui for it and create Entries programatically in a django view (not in admin)... (with authors in those cases being non-admin users) ...
Is there any reason why this would be a very bad idea, or is this something that would really break things in Zinnia ?
Thanks in advance
Cheers
Thomas
I've done one part of this a few months ago. The client found the admin interface too complicated and wanted something simpler. I created view/templates that allowed users to add/edit blog entries - There were no major issues.
That said, this was still for admin users - there may be permission issues or hidden assumptions in zinnia that users are admins. I doubt there would be much trouble overcoming them - it's a nicely written app with decent interfaces.
I can show you some code if you're interested.

Facebook communication to Application

The start-up i currently work for is oriented around restaurant wait times. For our v1.25 specifications our clients -restaurants- that have Facebook pages want to be able to communicate to their app profile from their Facebook page.
The closest i have came to answering this question is the Graph API. However, the Graph API only allows us to read and write data to FB pages. So, is there a way for a restaurants FB page to write to its app profile? Secondly, Loso, whom we have modeled some of our designs from has this ability, does anyone have an idea as to how they have done it?
--Boris M.
Here is an option that you can consider...
When you are designing the app you can also develop a page tab to go with it...
You will find this option in the basic settings of the app.
You can make it to install for all first time users of your app, by getting a list of all his pages he created using that profile then install it on the one he selects.
This page tab when installed on a page will appears just where other tabs on the page appers(e.g. events, notes etc. occurs)
You can provide your required functionality on this tab as you like.
Thus the user can just select that tab on the page and use its functionality to post on the profile page of the app.
Hope this works for you... and also u can check out the jobcaster app it does something like that!

How do I dynamically create new pages in a Django wiki?

I am creating a wiki in Django where users should be able to register, login, create pages and other users who also login should be able to see all created pages and then either create new pages or edit existing ones.
I have already created registration and login pages and I am fine with creating and editing content on pages. My question is - do any of you (who know Django) know how I can implement the create new pages into my site? I think it will be in a "form" form where you then specify the URL, title, and content of the new page, but how do you actually create the new pages then and be able to view all created pages to any user?
I am stuck at this wall and any help would be appreciated!
At the time of page create with the form that you mentioned, if the user is logged in, you will want to store the user ID as a foreign key in your page Model. Then when you go to display created pages for a specific user, you just follow the relationship.
This was posted a long time ago, so you will probably just want to use this Django App as it solves all of this for you, in one beautiful package:
https://github.com/benjaoming/django-wiki
Have you seen the tutorial here? http://showmedo.com/videotutorials/video?name=1100000
I built a wiki with that tutorial - I think even if it doesn't answer your question may still point you in the right direction. Hope it helps!

How to add Announcement list/webpart to Publishing Portal

I have a Publishing Portal site and I need to add some announcements to some of the pages. I've read an article which says that i have to create an announcement list to be able add an announcement web part but i can't seem to find any resources on how i can add an announcement list.
Any help will be greatly appreciated.
TIA!
Your problem is that you have not activated the relevant feature on the site settings page. You need to go to the site collection site settings page. Then select Site Actions - manage site features
Then activate the feature called Team Collaboration lists. You will now be able to create an announcement list
From the home page of your site (or from any page really) you should see a "View All Site Content" link on the top of the navigation menu.
View All Site Content http://friendfeed.s3.amazonaws.com/86fed07f0809beefaeeaee0013ee2b952079bc09
Click on that link and it will show you a dashboard listing all of the SharePoint lists that have been provisioned for the current site. Click on the Create button to create a new SharePoint list.
Create new SharePoint List http://friendfeed.s3.amazonaws.com/6c0b244801826f8b3ee01811211b88668ba8f713
From there you will see the option to create an Announcments list (under the Communications header). Complete the wizard to complete the list.
Once the list is created you can select Edit Page from the Site Actions menu on any SharePoint page in the site and then select a "Add a Web Part" on the web part zone you want to put your Announcements web part into. You should now see a web part listed with the same name as your Announcements list that you just created.
Select that web part to add it to the page and display.
Hope that helps. If this isn't the answer to your problem leave a comment or update your question with clarification and I will try to help.
Giving you direct instructions on how to create the list would most likely leave you more lost than ever. If this is a publishing portal, there's a lot more to learn beyond just creating a list. Content must be approved, and is versioned. I'd strongy advise you not to start poking around in there as you run a large risk of messing up the portal. Don't get stressed by people demanding you perform such things without having received any training. Grab yourself a coffee, flip your boss the finger and watch some pertinant webcasts on http://office.microsoft.com/en-us/sharepointserver/FX101211721033.aspx
Hope this helps,
Oisin