This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
i am trying to obtain how much likes one of my pages has, and only this one page isn't showing the likes field, even having about 1 thousand likes, check it out:
https://graph.facebook.com/233572770052788?fields=likes
{
"id": "233572770052788",
"type": "page"
}
This one, responds just fine:
https://graph.facebook.com/173268742773034?fields=likes
{
"likes": 348,
"id": "173268742773034",
"type": "page"
}
If you are using Like button for your non-facebook page.
Then you may retrieve number of likes as follows:
https://api.facebook.com/method/fql.query?query=select total_count from link_stat where url='http://tvg.globo.com/bbb/bbb12/videos/t/agora-na-casa/v/monique-tira-a-roupa-e-faz-a-alegria-da-casa/1762991/'
Try here
It uses following FQL Query: select total_count from link_stat where url='yourUrl'
Try opening a bug at facebook: https://developers.facebook.com/bugs
Facebook is full of bugs: http://www.quora.com/Is-it-true-that-Facebook-has-no-testers
Related
So i found a tracking pixel from this site www.scorecardresearch.com, and they offer an opt-out from their Program.
My question is: How do could they do this, how would they know i've opt-ed out after i closed the session(there are no cookies set from this site)?
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm new to django and I'm kinda confused on how to use django's url pattern matching.
This is my intention. I have 4 pages to a website. Depending on the links, they would use the url to find what information to present to the user. Also the url knows which page the user is on.
So the person would choose a building based on links.
The person would then choose the floor they wish to go on.
Finally the person would then choose a room.
Ex. format: aaa.com/buildingname/floornumber/roomnumber
step0 aaa.com/
step1 aaa.com/django/
step2 aaa.com/django/2/
step3 aaa.com/django/2/201
So based on the url pattern, the website should load up differently every time.
Is this how I am supposed to use url pattern matching? I really would like to get some help on this. What should the url pattern look like? As of right now all I can think of is just matching the url into different apps that have views. I just don't know how to link them all together.
And I have a MySQL database with the building,floor,and room number.
Thanks in advance everybody. I appreciate your effort.
Define url pattern pointing to different views as follows:
urlpatterns = patterns('your_app.views',
(r'^/(?P<building_name>\w+)/$','function1'),
(r'^/(?P<building_name>\w+)/(?P<floor>\d+)/$','function2'),
(r'^/(?P<building_name>\w+)/(?P<floor>\d+)/(?P<room>\d+)/$','function3'),
)
Use this pattern and it will call different views and in each view you can use different template. Or if you want to use same view function check for available values in URL and render whichever template you need. You can get the URL value in views as follows:
def function1(request, building_name = None):
print building_name
Likewise do it for other views also.
If you want them to be handled in the same view , you can pass arguments to the same view,
r('/(?P<building>\w+)/','views.view1')
r('/(?P<building>\w+)/(?P<flat>\w+)/','views.view1')
r('/(?P<building>\w+)/(?P<flat>\w+)/(?P<room>\w+)/','views.view1')
your view,
def view1(buidling="",flat="",room=""):
return []
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I have a model which allows users to upload an .ics file to a calender field via the FileField.
However this is not required so some objects will have associated files, other will not. In my template I want to output different things depending on this. I thought this would work...
My view passes a all the model objects in a seminarData variable..
{% for seminars in seminarData %}
{% if seminars.calender %}
{{seminars.title}}
{{seminars.message}}
Download .ICS File
{% else %}
{{seminars.title}}
{{seminars.message}}
{% endif %}
{% endfor %}
But this doesn't seem to work... Everything just goes straight to the else section even those objects with associated files in the calender field.
Could it becasue in my model I have
calendar = models.FileField(upload_to="/uploadedCal/", blank=True)
And I need to have null=True or something?
I played around inequality operators aswell with no luck... Thanks
Edit: I think the solution would be pretty straightforward I just can't see it annoyingly!
Calendar is spelt incorrectly in your if statement ;-)
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I'm writing some models. Specifically, a UserProfile model which is created by a post save hook on User.
Some strange things are happening here. The test suite passes on one computer, and fails on another. The error message is : profile_userprofile.organization_id may not be NULL, and yet here is my model:
class UserProfile(models.Model):
'Profile object for a user'
user = models.ForeignKey(User, unique=True)
organization = models.ForeignKey(
'organization.Organization',
related_name='volunteers',
null=True,
)
obviously, organization should allow null values, but it doesn't. Any ideas as to what's going wrong here? The same thing happens when calling User.objects.create() from the shell.
(oh, here's the hook)
#receiver(models.signals.post_save, sender=User)
def user_post_save(sender, instance, **kwargs):
'create a userprofile object for a user if one does not exist'
UserProfile.objects.get_or_create(user=instance)
Sounds like the database is not on sync in the second machine. Drop it and re-run syncdb.
Perhaps what you are looking for is blank=True.
I was missing a migration! Whoops!
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I have two django-apps.
news and comments
in news/models.py I import my comments with "from my_proj.comments.models import Comment"
and in my comments/models.py I import my news class with "from my_proj.news.models import News"
Then in my third app (named frontpage) I import News in the view.py.
But I get the error:
Could not import hb_frontpage.views. Error was: cannot import name News
If I delete the import in the comments/models.py file (and the functions that uses News) it works.
Anyone know how to solve this?
You don't actually need the News import at all. Looking at your code (which by the way should have been posted as an update to your question, not as an answer) the only reference to News is to look up the objects that are related to this particular comment. But Django has a built-in way of doing that from the comment itself:
news = self.news_set.all()
Using this, there's no need to get the News object and filter from there.
You can't do circular imports.
News needs comments to load, but to load comments you need to load news, but to load news you need to load comments but to load comments...
You should really only need to do one import. If you write what you are trying to do, I can give further advice.