I just don't really get this part
Say you clear a collection of tags by
calling $post->getTags()->clear(); and
then call $post->getTags()->add($tag).
This will not recognize tag being
already added before and issue two
database calls.
What 2 database calls will be issued? Delete all tags of the post then add one? Thats what I'd expect? Or will it be something else?
Did you try to call after the clear?
$entityManager->flush();
If this don't help try to remove one by one in foreach.
Related
I don't have a lot of experience in Django and I am a fairly green developer. When I run the localhost I keep getting a Internal Error. I have tried most of the solutions to similar problems here and none of them works. Can anyone help me? The code is not mine so I don't want to alter it as such either.
Here is a picture of the errors I keep getting:
The only thing you can do without altering the code is to enter the value "shop_all_art" in the HomePage table in the database.
Do not share code via images. You should also share the related code.
Your stacktrace clearly says, that Python is not able to access first element of HomePage.objects.filter(value='shop_all_art') in file bidgala/bidgala/pages/views.py. all_art_img is most probably empty.
Looks like all_art_img is empty.
you should check if a Query has any elements before with a method such as
if all_art_img.exists():
all_art_img[0]
I'm trying to use the Yummly API. I've noticed that some of their developers have answered other questions here, so I'm hoping to catch their eye. I used the documentation at the yummly developer site https://developer.yummly.com/documentation#IDs.
Specifically here is my get request:
<http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039>
Which returns this:
Please include X-Yummly-App-ID and X-Yummly-App-Key
Seems like this is a sensible thing, except that I don't see anywhere in the documentation for the single recipe call where I'm supposed to insert that info. Any one out there know how to properly format this?
or include them as URL parameters:
_app_id=app-id&_app_key=app-key
https://developer.yummly.com/documentation#IDs
Try this:
http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039?_app_id=ID&_app_key=KEY
You need to take the URL you mentioned in the question and add your authentication parameters to it. So it becomes:
http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039?_app_id=ID&_app_key=KEY
Instead of ID and KEY insert the application id and key from your account on developer.yummly.com
I have a recursive template.
new Ext.XTemplate(
'<tpl for="."><div>'+
'<div class="select">{text}</div>'+
'{[this.putChildren(values)]}'+
' </div></tpl>'
,
{
putChildren:function(values){
if(values.children){
Ext.each(values.children,function(child,index,arr){
return this.apply(values.children);
}
})
I set itemSelector:'select'
The thing is that when I load the data I get an error "records[i] is undefined" and when I set a listener the event is fired on every click but I get item=undefined on every node except the root.
I cant set a treeStore because dataview only excepts store or jsonstore. (maybe I'm doing something wrong?)
so I have a simple question how can I draw a tree using data view and a store?
I couldn't find any good recourse for this...
actually I have a template like this
http://www.youtube.com/watch?v=UhBjMws1H10&t=35m52s
I just cant load the data correctly...
do I need Store or TreeStore or something else?
thnx in advance
So why not use tree Panel?
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.tree.Panel
Have you ever solved this problem? Having the exact same issue. Although I haven't spent a lot of time with it for now.
Maybe it's useful for you to iterate directly through the children.
So, instead of
<tpl for=".">
i think you can directly use
<tpl for="children">
This makes it possible to use values as a variable already for each child.
I am almost done with my first production-ready django-project. I got one big problem left:
I got an article-search-view that renders a list of found articles. Pagination is working just fine for the resultlist. When I click on the article-title the object-detail-page opens. What I want: previous- and next-result-links on the object-detail-page.
I tried several approaches to similar problems but didn't find a working solution. If I try to use a paginator with only one article (for the object-detail-page) I need to know that paginator-index in the resultlist. But how?
Even the .get_next(previous)_by_foo-Method is not really usable in this scenario AFAICT. Or am I missing something obvious here? Thanks for any help in advance!
Paginator from django works with lists. A way of searching indexes in lists it's like that:
['aaa', 'bbb', 'ccc'].index('bbb') # result: 1
or so like this:
model = object()
[object(), object(), model].index(model) # result: 2
Hope that gives you a hint on how you find paginator-index on your list.
If you want to get a link, at object-details-page, to next item from search-result, you must get next item from the search-result. To get a next item you need to perform the same search query which was executed in search-page and apply some extra filters to get only the next item from that list. But here you have a problem: you only have object-id in object-details page, you don't have the search-term. Without search-term you won't be able to create the search-query. That means you need to get search-term somehow. How do you get that search-term? You need to pass it from the search-result-page somehow. You can save the search-term in session/cookie, or, maybe better: you can pass it via a GET parameter to object-details page. Now when you search-term in object-display page, you can perform a search-query, and from that query you can select the next and the previous objects.
I think now you should be able to implement that. If not you could show some of your code of object-details view, maybe someone will write some code for you.
you could use this
next »
« previous
I want to be able to have add-watch to call a callback when a database table changes (via clojureql). How can I get this to work?
Thats an interesting idea. Right now, all table references in ClojureQL are nothing but syntax trees which do nothing before getting de-referenced. This means that what you ask isn't directly possible.
I will be happy to consider it for inclusion in a post 1.0 release, if you would please make an issue on Github.
Thanks,
Lau