Stop duplicate flags in templatedetails.extra_flags

Improve the storing of new extra_flags (e.g. changing the template from flash to javascript).
This change stops duplicate keys.