Set default currency

main
Bob Mottram 2021-08-07 19:07:08 +01:00
parent b251ceab49
commit 5ad1622bb6
2 changed files with 17 additions and 2 deletions

View File

@ -119,6 +119,9 @@ parser.add_argument('--libretranslateApiKey',
dest='libretranslateApiKey', type=str,
default=None,
help='API key for LibreTranslate service')
parser.add_argument('--defaultCurrency', dest='defaultCurrency', type=str,
default="EUR",
help='Default currency EUR/GBP/USD...')
parser.add_argument('-n', '--nickname', dest='nickname', type=str,
default=None,
help='Nickname of the account to use')
@ -2696,6 +2699,11 @@ if args.registration:
setConfigParam(baseDir, 'registration', 'closed')
print('New registrations closed')
if args.defaultCurrency:
if args.defaultCurrency == args.defaultCurrency.upper():
setConfigParam(baseDir, 'defaultCurrency', args.defaultCurrency)
print('Default currency set to ' + args.defaultCurrency)
if __name__ == "__main__":
runDaemon(args.maxLikeCount,
sharedItemsFederatedDomains,

View File

@ -399,9 +399,16 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
for symbol, currName in currencies.items():
currencyList.append(currName + ' ' + symbol)
currencyList.sort()
defaultCurrency = getConfigParam(baseDir, 'defaultCurrency')
if not defaultCurrency:
defaultCurrency = "EUR"
for currName in currencyList:
if defaultCurrency not in currName:
extraFields += ' <option value="' + \
currName + '">' + currName + '</option>\n'
else:
extraFields += ' <option value="' + \
currName + '" selected>' + currName + '</option>\n'
extraFields += ' </select>\n'
extraFields += '</div>\n'