tigeorgia / shenmartav

Website for shenmartav.ge
GNU General Public License v2.0
3 stars 9 forks source link

Empty description fields show up with text on MP profiles #108

Closed EkaR closed 11 years ago

EkaR commented 12 years ago

Check this. "Description" fields for this MP are clear when viewing from the admin panel: http://shenmartav.ge/en/admin/representative/representative/15/

However, when viewing the profile on site, the equivalent "Activities" (Description=Activities) fields contain text. This is the text that was entered under "Description" previously and cleared days ago: http://shenmartav.ge/en/who/representative/15/akaki-bobokhidze/, http://shenmartav.ge/ka/who/representative/15/akaki-bobokhidze/ (საქმიანობა)

And this is for all profiles I have edited and cleared description for: Andro Alavidze, Archil Gegenava, Armenak Bainduriani, Aslan Tavdgiridze, Avtandil Lekashvili to name a few.

EkaR commented 12 years ago

Derek suggested trying to put something else under "Description", to see if it would change on the site and it did.

However, after I deleted those, they still show on the site. So, guessing that description field may not be left empty? Can this be changed? We cannot get rid of it completely, as information on their activities apart from Faction and Committee will be kept there.

sebastiantransparency commented 12 years ago

i guess you will see this behaviour with all representatives who were in the database before the model translations were introduced (and i have to take some blame not to have added this feature right from the start. to my excuse: i left it out to reduce complexity in the feature development process). the database has actually three fields stored for each translatable item: the english and georgian versions plus a default field. the default field is used if the field for your current language is empty, if i understand correctly. and the default field is updated with the contents of the english (default language) field once that is changed or of the georgian field if english is empty. but when all language-specific fields become empty strings, it fails to update that default field. so when visiting the page, the field for your language is empty and it uses the default field which is set to a previous value. it might be that this buggy behaviour is not exposed in newly created representatives. you cannot edit the default field, it's magic, but your local admin wizard can change it on the Django shell.

and that's what i did for the representatives mentioned above. could you please provide me with a list of all representatives (better their database id, like 15 for Akaki) where you have that problem?

i also modified the templates to not display 'Activities:' if that field is actually empty.

sebastiantransparency commented 12 years ago

just labelled is as done. remove it if necessary or close the issue, please.

ddohler commented 12 years ago

@EkaR can you close when you've confirmed?

EkaR commented 12 years ago

I checked several profiles and, indeed, most don't show the "Activites" that are supposed to be empty any longer except for:

2 Andro Alavidze 26 Kakha Getsadze

I will work on getting you the full list of profiles with this problem.

sebastiantransparency commented 12 years ago

done for these two.

i have found 56 more representatives with empty descriptions_[en|ka]. i could easily set descriptions to an empty value, but i am not sure if these really should be empty, they might have valid data. please advise.

ddohler commented 12 years ago

I think these should be empty, but @EkaR could you confirm?

EkaR commented 11 years ago

Sorry for not so good news but the problem seems to remain. Let's see representative 1, Nugzar Abulashvili, for example.

I removed text from the description field 10 or 15 minutes ago but it still shows up both in Georgian and English versions of the profile. I also changed some text in other fields and those were updated.

Look: http://shenmartav.ge/en/admin/representative/representative/1/

http://goo.gl/bf4Iz (public profile)

sebastiantransparency commented 11 years ago

well, the problem was never resolved in the first place. :) i looked through the database and now the (editor-invisible) description field has been set to an empty string if both description_[en|ka] are empty. and hence the 'activities' shouldn't show up any more for these representatives. at least it's true for http://shenmartav.ge/en/who/representative/1/%E1%83%9C%E1%83%A3%E1%83%92%E1%83%96%E1%83%90%E1%83%A0-%E1%83%90%E1%83%91%E1%83%A3%E1%83%9A%E1%83%90%E1%83%A8%E1%83%95%E1%83%98%E1%83%9A%E1%83%98/

ddohler commented 11 years ago

Okay, and if we delete the description_[en|ka] field at some point in the future (even if it has content now), will the invisible description field be automatically set to an empty string as well?

sebastiantransparency commented 11 years ago

it should be, i actually believe it will remain empty all the time. access to description in a template will automagically retrieve the data from description_[en|ka], depending on active language. this issue (once again) happened due to my inexperience when transitioning from non-translated database entries to translated entries while we already had data (see my first comment on this issue).

ddohler commented 11 years ago

Okay, we've confirmed that this works.