HOW TO USE DJANGO-SQL-EXPLORER IN TENDENCI MMS

tendenci6megamenu.png

Tendenci 6 ships with the excellent django-sql-explorer from ePantry. This means you can export anything at any time and build any report you want whenever you want. Absolute 100% anytime freedom of access to your data. #JOY #FREEDOM #ROCKS

First a warning. If you choose to use a direct query tool know they are dangerous. You are doing so at your own risk and could possibly corrupt your database beyond repair up to and including requiring a dba to come in and repair it at a cost of thousands of quid. So…. BE CAREFUL.

SQL explorer is a way to directly query your site through the user interface. It is for superusers only and we recommend disabling it by default (see disclaimer above.) But if you are still reading here is the lightning version.

  1. Login to your Tendenci6 site at /accounts/login/
  2. Navigate to /explorer/
  3. Click on playground and test out some queries. For example here are two
    1. “select tablename from pg_tables” – without the quotes to list all 300 tables in your database
    2. “select * from articles_article” – list all articles including expired and inactive etc.
  4. If you like the queries click “new query” and name and describe them and click save.
  5. Click on the SQL explorer icon top left and your back at the dashboard with icons to download the results of your queries.

Visually when you add the URL /explorer/ to the end of your site path you will see something very similar to this.

django-sql-query-dashboard.png

First note the icon on the right to Download CSV so you can download all of whatever that query is for.  If you don’t see any, no worries – that’s what this post is about!

So let’s write a basic sql statement.

django-sql-playground.png

And then when you click “New  Query” you will find this interface and you can carefully name and describe your query so you know what it does later.

creating-new-tendenci-query-for-csv-download.png

 

1) ALL Interactive users:

SELECT  u.first_name, u.last_name, u.email, u.username, u.is_staff,  u.is_superuser, p.salutation, p.company, p.position_title, p.phone,  p.address, p.address2, p.member_number, p.city, p.state, p.zipcode,  p.country, p.url, p.sex, p.address_type, p.phone2, p.fax, p.work_phone,  p.home_phone, p.mobile_phone, p.notes, p.admin_notes FROM auth_user u  INNER JOIN profiles_profile p ON u.id=p.user_id WHERE u.is_active=True  AND p.status=True AND p.status_detail='active'

Copy Paste Version:

SELECT u.first_name, u.last_name, u.email, u.username, u.is_staff, u.is_superuser, p.salutation, p.company, p.position_title, p.phone, p.address, p.address2, p.member_number, p.city, p.state, p.zipcode, p.country, p.url, p.sex, p.address_type, p.phone2, p.fax, p.work_phone, p.home_phone, p.mobile_phone, p.notes, p.admin_notes FROM auth_user u INNER JOIN profiles_profile p ON u.id=p.user_id WHERE u.is_active=True AND p.status=True AND p.status_detail=’active’

2) ALL memberships:

SELECT u.first_name, u.last_name, u.email, u.username, u.is_staff, u.is_superuser,
    p.salutation, p.company, p.position_title, p.phone, p.address, p.address2, 
    p.member_number, p.city, p.state, p.zipcode, p.country, p.url, p.sex, 
    p.address_type, p.phone2, p.fax, p.work_phone, p.home_phone, p.mobile_phone,
    m.membership_type_id, m.renewal, m.certifications, m.work_experience,
    m.referer_url, m.referral_source, m.join_dt, m.expire_dt, m.renew_dt,
    m.primary_practice, m.how_long_in_practice, m.application_approved,
    m.application_approved_dt, m.areas_of_expertise, m.home_state,
    m.year_left_native_country, m.network_sectors, m.networking,
    m.government_worker, m.government_agency, m.license_number,
    m.license_state, m.status_detail
FROM auth_user u
INNER JOIN profiles_profile p
ON u.id=p.user_id
INNER JOIN memberships_membershipdefault m
ON m.user_id=u.id
WHERE u.is_active=True
AND p.status=True
AND m.status_detail <> 'archive'

Copy Paste Version:

SELECT u.first_name, u.last_name, u.email, u.username, u.is_staff, u.is_superuser, p.salutation, p.company, p.position_title, p.phone, p.address, p.address2, p.member_number, p.city, p.state, p.zipcode, p.country, p.url, p.sex, p.address_type, p.phone2, p.fax, p.work_phone, p.home_phone, p.mobile_phone, m.membership_type_id, m.renewal, m.certifications, m.work_experience, m.referer_url, m.referral_source, m.join_dt, m.expire_dt, m.renew_dt, m.primary_practice, m.how_long_in_practice, m.application_approved, m.application_approved_dt, m.areas_of_expertise, m.home_state, m.year_left_native_country, m.network_sectors, m.networking, m.government_worker, m.government_agency, m.license_number, m.license_state, m.status_detail FROM auth_user u INNER JOIN profiles_profile p ON u.id=p.user_id INNER JOIN memberships_membershipdefault m ON m.user_id=u.id WHERE u.is_active=True AND p.status=True AND m.status_detail <> ‘archive’

3) ALL corporate members:

SELECT cp.name, cp.address, cp.address2, cp.city, cp.state, cp.zip, cp.country,
    cp.phone, cp.email, cp.url, cp.number_employees, cp.chapter, cp.tax_exempt,
    cp.annual_revenue, cp.annual_ad_expenditure, cp.description, cp.expectations,
    cp.notes, cp.referral_source, cp.ud1, cp.ud2, cp.ud3, cp.ud4, cp.ud5, cp.ud6, 
    cp.ud7, cp.ud8, cm.corporate_membership_type_id, cm.renewal, cm.renew_dt,
    cm.join_dt, cm.expiration_dt, cm.approved, cm.admin_notes, cm.status_detail
FROM corporate_memberships_corpprofile cp
INNER JOIN corporate_memberships_corpmembership cm
ON cp.id=cm.corp_profile_id
WHERE cm.status_detail <> 'archive'

Copy Paste Version:

SELECT cp.name, cp.address, cp.address2, cp.city, cp.state, cp.zip, cp.country, cp.phone, cp.email, cp.url, cp.number_employees, cp.chapter, cp.tax_exempt, cp.annual_revenue, cp.annual_ad_expenditure, cp.description, cp.expectations, cp.notes, cp.referral_source, cp.ud1, cp.ud2, cp.ud3, cp.ud4, cp.ud5, cp.ud6, cp.ud7, cp.ud8, cm.corporate_membership_type_id, cm.renewal, cm.renew_dt, cm.join_dt, cm.expiration_dt, cm.approved, cm.admin_notes, cm.status_detail FROM corporate_memberships_corpprofile cp INNER JOIN corporate_memberships_corpmembership cm ON cp.id=cm.corp_profile_id WHERE cm.status_detail <> ‘archive’

4) All users in a specific group (replace <YOUR GROUP ID> with your group id)

SELECT ug.name, u.first_name, u.last_name, u.email, u.username, u.is_staff, u.is_superuser, p.salutation, p.company, p.position_title, p.phone, p.address, p.address2, p.member_number, p.city, p.state, p.zipcode, p.country, p.url, p.sex, p.address_type, p.phone2, p.fax, p.work_phone, p.home_phone, p.mobile_phone FROM auth_user u INNER JOIN profiles_profile p ON u.id=p.user_id INNER JOIN user_groups_groupmembership ugm on u.id=ugm.member_id INNER JOIN user_groups_group ug on ug.id=ugm.group_id WHERE ug.id=<YOUR GROUP ID> AND ugm.status=True AND ugm.status_detail='active'

Copy Paste Version:

SELECT ug.name, u.first_name, u.last_name, u.email, u.username, u.is_staff, u.is_superuser, p.salutation, p.company, p.position_title, p.phone, p.address, p.address2, p.member_number, p.city, p.state, p.zipcode, p.country, p.url, p.sex, p.address_type, p.phone2, p.fax, p.work_phone, p.home_phone, p.mobile_phone FROM auth_user u INNER JOIN profiles_profile p ON u.id=p.user_id INNER JOIN user_groups_groupmembership ugm on u.id=ugm.member_id INNER JOIN user_groups_group ug on ug.id=ugm.group_id WHERE ug.id=<YOUR GROUP ID> AND ugm.status=True AND ugm.status_detail=’active’

 

 

 

Contribute back your brilliance to the rest of us? Have you written some good queries for Tendenci using the amazing  django-sql-explorer from ePantry? Post them on the Tendenci Community Site for others to learn and share with!

Please do be careful. Remember the warnings above. Using a live sql tool on a relational database for anything besides SELECT queries is ill-advised. It really is your live data on a live site SO BE CAREFUL!

We believe this level of access to the superusers on Tendenci sites is empowering. We like knowing people can download any of their data when they need it. And perhaps contribute back some suggested new reports to the Tendenci Community as a whole!

Because Tendenci is part of the Django community and we couldn’t have brought this functionality to you without others in the community “giving first.” We may have added it to Tendenci, but that’s ONLY because of the generosity of building and making it available by others. Explorer is brought to you by the power of collaborative open source software (THANK YOU ePantry!)

Note this is a cross post from our help files. See the Help File for the latest accurate info at: https://www.tendenci.com/help-files/how-use-django-sql-explorer-tendenci/

The World is a Big Place: We’ve Gone Virtual!

Two years in the making, November 2014 marked the launch of our initiative to be a virtually enabled team!

We have moved out of our corporate office space in Houston’s Energy Corridor and are now stretching our wings in the boundless space of working in the virtual world – any time, any place.

With employees and partners situated all over our lovely planet Earth, it only made sense to reduce our carbon footprint and embrace the flexibility that comes with working without walls. A lot of planning went in to setting the company up for this change, altering our processes and finding new systems that increased communication and tracking. Here are some of the things we have changed.

1. Using HipChat for internal communication.

hipchat

Our employees are online during corporate business hours and we have a running chat going for constant communication. By linking to client sites or helpdesk tickets, we can share information, collaborate on projects and retain our water cooler discussions. We also hold daily standup meetings via HipChat to make sure everyone has the information they need for the day ahead.

2. Implementing HelpDesk for client communication.

Helpdesk

Our new ticketing system at helpdesk.tendenci.com allows our clients to submit a request directly into the queue where any member of the team can grab the ticket and begin the dialogue. By having all requests in one place, tickets don’t get lost in one employee’s email, assistance can be shared among the team and we can spot trends that indicate where a systemic solution may be needed. Screenshots and other files can be uploaded to the tickets, too, for better communication.

3. Switching to a VoIP-based phone system.

If you are still reading, this is where we could really use your help! We are using a national VoIP vendor but have had calls dropped or not ring through. Very embarrassing. Can anyone recommend a good option for a virtual phone system? We love to talk to our clients! In the meantime, if you are having trouble reaching us over the phone, please use helpdesk.tendenci.com to ask your question so that we can reach you!

And while working in your slippers does have its advantages, sometimes you just need to meet up in person to review a project. Those of us in the Houston area still meet to collaborate as teams a couple of days a week at one of the many co-working facilities in town, such as the space at Houston Technology Center in Midtown and ShareSpace out on the East Side.

So if you drive by the old office, you won’t see our name out front as we are no longer rooted in one place. We have set up a mailbox for written correspondence at this address:

Tendenci, Inc.
14027 Memorial Drive #177
Houston, Texas 77079-6826

And our dropbox for payments remains:

Tendenci, Inc.
P.O. BOX 301750
Dallas, Texas 75303-1750

But as to where we are physically located, well… spread out a world map, close your eyes and point. There we are!

(This is the first of three blog posts that discusses the tools we are using as the brain can only process so much in one day. Talking about mine, not yours! We welcome any feedback on tools you have used in your virtual work environment to increase communication – the biggest hurdle we are facing a dispersed team.)

Planned Server Updates as Everyone is Watching the Superbowl Pregame Show

All – there will be a few brief site outages this afternoon as we cycle through the data centers hosting, t4, t5 and t6 sites, installing a few more security updates while y’all are eating chips and watching the pre-game-show. (reboots mostly depending on the OS – some won’t need a reboot at all.)

Security never sleeps, not even on superbowl sunday. So if your site is offline briefly it’s OK. It’ll be right back. We don’t care much about the game but definitely want to see the commercials so hopefully it’ll all happen so fast you won’t notice.

Gary Hoover On How to “Think Like an Entrepreneur” and Succeed in Your Business

This week, I had the distinct honor of hearing Gary Hoover present at the Houston Technology Center on how to “Think Like an Entrepreneur”.  Gary Hoover is a successful entrepreneur having founded companies including Bookstop and Hoovers.com and he’s spent the last year as the “Entrepreneur in Residence” at the McCombs School of Business at the University of Austin.

Gary’s presentation was described as an “intense, information and idea packed presentation… [that] will be like drinking from a fire hydrant.”  That description was spot-on.

I took over 5 pages of notes, mostly trying to type as fast as I could and catch the great and inspiring quotes of wisdom plus the recommendations for books and specific, actionable items Gary said we could do to change the way we thought and be more successful and innovative in business.  

Gary began his presentation by personally handing everyone in the audience his business card and shaking our hands.  On the back of Hoover’s card are the top 8 things he believes are keys to making great enterprises.  Download a larger photograph of his business card with the 8 tips to keep and view more photos from the evening presentation in the Tendenci Photo Album I’ve created.

If you are interested in a  full copy of my notes, leave a comment below or send me an email at sworthy@tendenci.com and I’ll gladly send them to you.

I was inspired by how much of what Gary recommended for being a more successful entrepreneur also applied to the work we do at Schipul for our clients in web development, website design, and web marketing.  In learning to think more like an entrepreneur, you also learn to see different perspectives, understand the ‘bigger picture’ of your business, and receive lifelong benefits personally and professionally.

Probably the most profound statement of the evening from Gary was when he said:

‘I define entrepreneurship as getting great personal satisfaction from serving others… you have to love it and others have to love [what you are giving them].  

The people who are most happy with their lives at my stage are the people who have spent their whole lives working to make the world a better place.”

Here are Gary’s recommendations for learning how to “Think Like an Entrepreneur”.  My goal is for you to find the same inspiration and ways to relate them to your daily life as I found.

Practice the Habit of Wisdom

‘These are people who just cannot be anything but an entrepreneur.    They may fail a lot’ because it’s hard to get them to sit still, hard to get them to focus… but ultimately they are going to succeed because they just don’t stop.”

As Gary states, some people are born fundamentally entrepreneurial and others are born to be bureaucrats, while the rest of us fall someplace in between the 2 extremes.  If you want to become more entrepreneurial, then you will need to change by developing better thinking habits.

To develop these habits, you’ll first need to master the 3 things Gary calls his working definition of wisdom :

  1. Knowing what matters and what doesn’t matter.
  2. Knowing what changes and what doesn’t change.
  3. Knowing what you can change and what you can’t change.

These are three easy concepts to understand and yet, very difficult to master. As Gary put it, “There’s no rocket science here, but you’ll spend your whole life trying to figure out what matters and what doesn’t.”

Be Curious

“Study the great entrepreneurs, like Steve Jobs, Bill Gates, Michael Dell and so on, and you’ll find an intense curiosity.”

Gary explains the importance of doing your research before starting a new business venture.  The most successful entrepreneurs are the ones who ask the most questions and really understand the marketplace, the customers and competitors, and gain insight into the future of the business environment.

Ask the managers and owners of similar businesses questions like:

  • What do you like about your job, and what don’t you like?
  • What is the best day you’ve ever had… describe your worst day?
  • What do you look for in an employee and how do you hire and train new people?

By asking questions and being curious, you can begin to gain perspectives from other people and understand the why’s and the how’s and the what’s…

When you begin to understand these different perspectives beyond your own, you can make better decisions and you are more equipped to solve problems as they are thrown randomly at you.

Read Every Day

“The key question is do you see yourself in a box or not in box?”

The greatest thought leaders in the world are also the most avid readers.  Read daily, Gary recommends, books and business journals… the beauty of the internet is the availability of so much free and great reading material.

Here are 2 books Gary recommended Tuesday night:

The Innovator’s DNA: Mastering the Five Skills of Disruptive Innovators” by Jeff Dyer, Hal Gregersen and Clayton M. Christensen

The Innovators DNA describes 4 skills required for innovation:

  1. Observing
  2. Networking
  3. Experimenting
  4. Questioning

Mindset: The New Psychology of Success” by Carol Dweck

Mindset describes the importance of not locking your children or yourself into a set way of thinking.  Gary recommended this book and said “It’s not about being smart or being stupid: people who think they’re smart are locking themselves in a box just like people who think they’re stupid.”

Entrepreneurship is not About the Technology

“Entrepreneurship is a lifelong process of self-understanding: learning about yourself .”

As I listened to Gary’s presentation, I found myself mentally replacing the word “entrepreneurship” with “Marketer” and “Schipulite”. We’re passionate about providing great service to our clients.  We’re constantly asking questions and inviting our clients to come hang out with us so we can get to know you.  We never stop trying to innovate and find better ways to help your business increase online and offline revenues through your website and web marketing.

These quotes from Gary’s presentation were my favorite because they gave me new perspectives on creating a better user experience through our Tendenci CMS for you, your staff, and your website visitors:

‘When I use the word technology, I mean any way of doing better things…  Technology is only relevant to the extent that it makes people’s lives better!”

“Step back and look at the big pattern’ and the big pattern here is that ALL MEDIA has been digitalized, it’s all been turned into 0’s and 1’s.”

Be obsessed with your customer and making great products for them and you will succeed’ be passionate about it.  It is about making it good for the user!”

I would love to hear how we can make our products and services better for You and anything else you want to add!  Please tell us below in our comments or Come Hang Out With Us and get to know us.  (And I promise to ask you lots of questions!)

Schipul Releases Open Source Tendenci CMS for NonProfit Websites

We love Open Source and our clients do too!  We often hear from clients that you only will use open source software to build your websites and the advantages of having an open source community of developers and designers are undeniable.

That’s why everyone here at Schipul is super excited to announce we can now offer you a new open source option in addition to Drupal and WordPress open source website development and design with our open source release of our Tendenci CMS for NonProfit Websites.

Tendenci.org

Tendenci is the First Open Source CMS Made Just for Non-Profits!

The open source release of Tendenci is now available as part at the  Nonprofit Technology Conference  in San Francisco going on this week, April 3-5.

If you are at NTEN NTC 2012, come to the NetSquared Local Community Organizers #12NTC Beerside Chat tonight at Jasper’s.  Come learn more about the event  and come hang out with us in San Francisco this week!

Read More Details about the Open Source Announcement!

Here’s photos of the nonprofit tech conference that our team of Schipulites attending NTEN’s NonProfit Technology Conference are shooting and sharing daily.

What Does This Mean for Current Schipul Clients?

Here are some links with information for our current clients to explain what this means for you and your website, and what open source software is:

Open Source Tendenci FAQ for Current Tendenci Clients | From the Tendenci Blog

What is the Difference Between Tendenci Enterprise and Tendenci Community? FAQ

Open Source Hosting Prices and FAQ with the Tendenci Community

Download, Deploy and Host Your Own Open Source NonProfit Website with Tendenci CMS

We have set-up a public repository on Github for Tendenci where you can access the software for those looking to host their own Tendenci website here:  https://github.com/tendenci/tendenci/.  The Tendenci CMS is written in the Python programming language within a Django framework.

Visit Tendenci.org for information and help with our open source CMS.

If you have additional questions, comments, concerns, etc. please don’t hesitate to contact us, or post them in the comments below.

Get All the Open Source Tendenci News

Sign up on our email list below to receive  the latest updates about the open source release of Tendenci – The CMS for Non-Profits and Share the news with your friends!