forked from 0x2620/pandora
update vm build. use title for new lists not id, also make first user admin
This commit is contained in:
parent
956854d5bc
commit
0eeb3e223d
8 changed files with 35 additions and 29 deletions
|
|
@ -41,9 +41,10 @@ def load_config():
|
|||
settings.CONFIG = config
|
||||
|
||||
admin = len(settings.CONFIG['userLevels']) - 1
|
||||
settings.ADMIN = tuple([(u.username, u.email)
|
||||
for u in User.objects.filter(profile__level=admin)])
|
||||
settings.MANAGERS = settings.ADMINS
|
||||
if not 'syncdb' in sys.argv:
|
||||
settings.ADMIN = tuple([(u.username, u.email)
|
||||
for u in User.objects.filter(profile__level=admin)])
|
||||
settings.MANAGERS = settings.ADMINS
|
||||
|
||||
def reloader_thread():
|
||||
_config_mtime = 0
|
||||
|
|
@ -61,7 +62,11 @@ def update_static():
|
|||
oxjs_build = os.path.join(settings.STATIC_ROOT, 'oxjs/tools/build/build.py')
|
||||
if os.path.exists(oxjs_build):
|
||||
print 'update oxjs'
|
||||
os.system('%s -nogeo >/dev/null' % oxjs_build)
|
||||
if os.path.exists(os.path.join(settings.STATIC_ROOT, 'oxjs/build/Ox.Geo/json/Ox.Geo.json')):
|
||||
geo = '-nogeo'
|
||||
else:
|
||||
geo = ''
|
||||
os.system('%s %s >/dev/null' % (oxjs_build, geo))
|
||||
|
||||
data = ''
|
||||
js = []
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ def serve_static_file(path, location, content_type):
|
|||
|
||||
urlpatterns = patterns('',
|
||||
(r'^admin/', include(admin.site.urls)),
|
||||
(r'^ajax_filtered_fields/', include('ajax_filtered_fields.urls')),
|
||||
(r'^api/upload/$', 'archive.views.firefogg_upload'),
|
||||
(r'^url=(?P<url>.*)$', 'app.views.redirect_url'),
|
||||
(r'^file/(?P<oshash>.*)$', 'archive.views.lookup_file'),
|
||||
|
|
|
|||
|
|
@ -129,6 +129,9 @@ class UserProfile(models.Model):
|
|||
|
||||
def user_post_save(sender, instance, **kwargs):
|
||||
profile, new = UserProfile.objects.get_or_create(user=instance)
|
||||
if new and instance.is_superuser:
|
||||
profile.level = len(settings.CONFIG['userLevels']) - 1
|
||||
profile.save()
|
||||
SessionData.objects.filter(user=instance).update(level=profile.level,
|
||||
username=instance.username)
|
||||
models.signals.post_save.connect(user_post_save, sender=User)
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ def signup(request):
|
|||
user.save()
|
||||
#create default user lists:
|
||||
for l in settings.CONFIG['personalLists']:
|
||||
list = models.List(name=l['id'], user=user)
|
||||
list = models.List(name=l['title'], user=user)
|
||||
for key in ('query', 'public', 'featured'):
|
||||
if key in l:
|
||||
setattr(list, key, l[key])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue