Useful Tildev Things

Assorted snippets you might find useful when developing for Tildes. Feel free to add your own!

All commands below are run inside the Vagrant box, to get inside use vagrant ssh.

Creating new users

In the interactive Python shell:

from tildes.models.user import User;
request.db_session.add(User('AnotherUser', 'correct horse battery staple'));
request.tm.commit();
Creating new groups

In the interactive Python shell:

from tildes.models.group import Group;
request.db_session.add(Group('testing.more', 'A manually created group to use for testing even more'));
request.tm.commit();
Grant permissions

In the PostgreSQL interactive terminal:

update users set
permissions = '["permission_1", "permission_2", "permission_n"]'
where username = 'TestUser';

Substitute permission_1, permission_2, etc for any wanted permission and/or username = 'TestUser' for the wanted user.

Available permissions

Below is a table of just a few available permissions, to find more search through the various models for the __acl__ function.

Name Effect
admin Lock topics, remove topics/comments, ban users, ...
comment.label Apply labels to comments.
view_labels See all labels applied to comments and the label appliers.
wiki Edit and create wiki pages.
Adding financial data

Adding all 3 types of financial data (goal, income and expense) will make the donation goal meter and financials page work properly. If the date ranges are no longer in the current month, you may have to adjust them.

In the PostgreSQL interactive terminal:

insert into financials (entry_type, description, amount, date_range) values
('GOAL'::financialentrytype, 'The Goal', '50', '[2020-02-01 14:30, 2020-03-01 15:30)'),
('INCOME'::financialentrytype, 'Income Amount', '25', '[2020-02-01 14:30, 2020-03-01 15:30)'),
('EXPENSE'::financialentrytype, 'Expense Amount', '15', '[2020-02-01 14:30, 2020-03-01 15:30)');

If you know how to make the date ranges get generated based on the current date, feel free to edit this snippet.


The text of this wiki page is licensed under Creative Commons Attribution-ShareAlike 4.0.

Back to wiki page list