Please enable JavaScript to use RhodeCode Enterprise
##// END OF EJS Templates
neko259
- Wed, 28 Dec 2016 20:47:37
Show More
boards/migrations/0054_auto_20161228_2244.py
0
created
644
+25
0
@@
-0,0
+1,25
b''
1
# -*- coding: utf-8 -*-
2
# Generated by Django 1.10.4 on 2016-12-28 20:44
3
from __future__ import unicode_literals
4
5
from django.db import migrations , models
6
7
8
class Migration ( migrations . Migration ):
9
10
dependencies = [
11
( 'boards' , '0053_auto_20161127_1541' ),
12
]
13
14
operations = [
15
migrations . AlterField (
16
model_name = 'attachment' ,
17
name = 'alias' ,
18
field = models . TextField ( null = True , unique = True ),
19
),
20
migrations . AlterField (
21
model_name = 'attachment' ,
22
name = 'url' ,
23
field = models . TextField ( blank = True , default = '' ),
24
),
25
]
boards/admin.py
0
+9
-1
@@
-148,9
+148,17
b' class BannerAdmin(admin.ModelAdmin):'
148
148
149
149
@admin . register ( Attachment )
150
150
class AttachmentAdmin ( admin . ModelAdmin ):
151
list_display = ( 'mimetype' , 'file' , 'url' , 'alias' )
151
list_display = ( '__str__' , 'mimetype' , 'file' , 'url' , 'alias' )
152
152
search_fields = ( 'alias' ,)
153
153
154
def delete_alias ( self , request , queryset ):
155
for attachment in queryset :
156
attachment . alias = None
157
attachment . save ( update_fields = [ 'alias' ])
158
self . message_user ( request , _ ( 'Aliases removed' ))
159
160
actions = [ 'delete_alias' ]
161
154
162
155
163
@admin . register ( GlobalId )
156
164
class GlobalIdAdmin ( admin . ModelAdmin ):
boards/management/commands/statistics.py
0
+3
-3
@@
-11,7
+11,7
b' class Command(BaseCommand):'
11
11
def handle ( self , * args , ** options ):
12
12
print ( '* Domains and their usage' )
13
13
domains = {}
14
for attachment in Attachment . objects . exclude ( url = None).exclude(url='' ):
14
for attachment in Attachment . objects . exclude ( url = '' ):
15
15
full_domain = attachment . url . split ( '/' )[ 2 ]
16
16
domain = get_domain ( full_domain )
17
17
if domain in domains :
@@
-25,10
+25,10
b' class Command(BaseCommand):'
25
25
print ( '* Overall numbers' )
26
26
print ( ' {} attachments in the system, {} of them as URLs' . format (
27
27
Attachment . objects . count (),
28
Attachment . objects . exclude ( url = None) . count ()))
28
Attachment . objects . exclude ( url = '' ) . count ()))
29
29
30
30
print ( '* File types' )
31
mimetypes = Attachment . objects . filter ( url = None) \
31
mimetypes = Attachment . objects . filter ( url = '' ) \
32
32
. values ( 'mimetype' ) . annotate ( count = Count ( 'id' )) \
33
33
. order_by ( '-count' )
34
34
for mimetype in mimetypes :
boards/models/attachment/__init__.py
0
+2
-2
@@
-45,8
+45,8
b' class Attachment(models.Model):'
45
45
file = models . FileField ( upload_to = get_upload_filename , null = True )
46
46
mimetype = models . CharField ( max_length = 50 , null = True )
47
47
hash = models . CharField ( max_length = 36 , null = True )
48
alias = models . TextField ( unique = True , null = True , blank=True)
49
url = models . TextField ( null= True , blank= True)
48
alias = models . TextField ( unique = True , null = True )
49
url = models . TextField ( blank = True , default = '' )
50
50
51
51
def get_view ( self ):
52
52
file_viewer = None
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
g 0-9
Goto bookmarked items from 0-9
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository access permissions settings
t s
Toggle sidebar on some pages