What are the possible values of 'gender' field in Facebook Graph API? - facebook-graph-api

Facebook recently introduced many options for Gender besides male and female. Is there a list of all possible values for 'gender' field in Graph API?

Ok I found out. I tried setting custom gender in a test account.
The possible values are still only 'male' and 'female'. When you select a custom gender and then enter one of the custom genders, then there is a field near the bottom with option - What pronoun do you prefer?
Here depending on what you choose the gender field returns 'male' or 'female', irrespective of what you enter in 'Gender'. However, if you choose 'Neutral' then Graph API has no 'gender' field in it.

This article gives a list of all the possible genders they were able to find but they note that Facebook has not published an official list. http://www.slate.com/blogs/future_tense/2014/02/13/facebook_custom_gender_options_here_are_all_56_custom_options.html

Related

Django Forms: How to reference existing object field values in form validation?

So I am creating a Django app which I hope will be used in my school. This means that I have users that are teachers and students, and different permissions for these accounts. I have set it up so that every accounts has a self.teacher attribute, which is a boolean. So for students accounts, self.teacher will be False, and for teachers, self.teacher will be True.
My app also contains a profile page, and this page has an edit profile feature. In my app, I want the user to be able to edit, amongst other things, their grade. Now, I have it set up so that grade can be an option of:
- 10
- 11
- 12
- N/A
Students must only be able to pick a number, while teachers are allowed to select N/A. So I want to have a form validation (which validates the grade field) that checks to see if the user submitting the form is a student, and if so, checks that they have not selected N/A. If they have selected N/A, the validation should raise an error.
Any thoughts on how to implement this using Django Forms?
If you don't want students to select a given value (here: 'N/A'), the best way is to remove this value from the choice list. In the __init__ method of the form, checks if the form instance is a student or not, and if so, remove the 'N/A' value from the choice list.

How to create Dynamic action in APEX4.1 Tabular form

am Using Apex4.1,
in my application I have one Tabular form which has the following fields,
Emp_id
Emp_name
Dept_id
Here Emp_id is the Updatable column and it is a select list LOV and
Emp_name is a upadatable column,
Here what I need is,
If I select the Emp_id from the LOV ,the Emp_Name should be stored automatically based
on the value selected in EMP_ID,
In tabular form I could not create Dynamic action like creating in normal forms,
Can anyone help me in this issue?
Thank you.
APEX does not currently provide dynamic actions on tabular form items. Hopefully this may be addressed in APEX 4.2 but the Statement of Direction does not explicitly say so.
So for now if you need to do this you will have to write your own Javascript, using the unique IDs of the tabular form items to manipulate them (the IDs look like "fcc_rrrr" where "cc" is the column number and "rrrr" is the row number). See this SO q&q for sample Javascript code that uses these.
The Javascript you need to write is a little daunting (for a beginner), but one thing to note is that in your case you can avoid any need for using AJAX to get the employee name by embedding the name in the return value of the LOV something like this:
select emp_name d, emp_id||':'||emp_name r
from employee
order by 1
This way the return values will look like '123:John Smith'; your Javascript can parse this string and extract 'John Smith' and insert it into the emp_name item on the same row. Obviously you will also need to parse this string to obtain the emp_id value you will need when updating the database when the page is submitted.

How to get a real-size profile picture from a user?

Having a User ID xUID, i know I can get a profile picture this way:
http://graph.facebook.com/xUID/picture?type=large
The problem is that the picture returned from that URL is not the real size (it's about 200px wide).
I need to get that user picture, but real size.
What i've done so far is:
1. Getting the user albums
https://graph.facebook.com/me/albums?access_token=xToken
2. Iterating on that, and getting the album that have the type="profile".
3. With that Album ID (xAID) I can construct a FQL query:
SELECT pid, object_id, src_big FROM photo WHERE album_object_id = xAID
4. And getting the profile pictures there.
5. I need to iterate and find the lastone uploaded by the user.
So, this process is complex and time consuming. Is there any better/simpler/faster way to acomplish this?
Thanks a lot!
http://graph.facebook.com/xUID/picture?width=720&height=720
You need to perform only one FQL query:
SELECT pid, object_id, src_big
FROM photo
WHERE object_id IN
(SELECT cover_object_id
FROM album
WHERE owner=me() AND type="profile")
src_big will contain link to profile original source.
If you need to get specific user's profile picture please change me() with specific user id.
Ok, just did as the question said. Browse the Albums, and getting the first profile picture from there.
The answer from Julio doesn't work becouse it's not possible to include "type" on a WHERE clause, becouse it's not an indexable column.
The cover photo also isn't always the most recent photo, as of a few days ago.
Get cover_object_id:
fql?q=SELECT cover_object_id, type FROM album WHERE owner="userid" AND type="profile"
Get src_big:
fql?q=SELECT pid, object_id, src_big FROM photo WHERE object_id="cover object id obtained above"
img src="src_big obtained above"
This helps in something?

Getting user likes and friends likes by category

I need to get a user's music and movie likes, and a user's friends music and movie likes. Is there a way to add to the following query the category name?
https://graph.facebook.com/me/likes
https://graph.facebook.com/likes?ids=id1,id2...
I tried adding &category=Musician%2fband but that doesn't work.
Does anyone have an idea of how it can be done?
Thanks
JD
Try using FQL (http://developers.facebook.com/docs/reference/fql/page_fan/ and http://developers.facebook.com/docs/reference/fql/page/)
fql?q=SELECT page_id,type, description FROM page WHERE page_id IN (SELECT uid, page_id, type FROM page_fan WHERE uid=me()) AND type='musician/band'
EDIT
Since August 17, 2016, FQL is no longer available and cannot be queried.

Mediawiki dropdown value: from category + none

In mediawiki, I made a form with some dropdown lists that get their values from a category:
{{{field|Managers|mandatory|input type=dropdown|values from category=myTeam}}}
This works, it will show me a list of everyone in my team. However, somehow it should be possible to select "none", which is not in my category (duh!). Can someone tell me how to I can add an extra value to this dropdown list?
Create a page named None and populate it with [[Category:myTeam]] seems the simplest solution based on your details.