1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 06:34:40 +00:00

add index to UserStarredFile

This commit is contained in:
lins05
2013-03-30 20:38:14 +08:00
parent 5e45bb2724
commit ccd2605af1
2 changed files with 5 additions and 2 deletions

View File

@@ -157,7 +157,7 @@ class UserStarredFiles(models.Model):
email = models.EmailField()
org_id = models.IntegerField()
repo_id = models.CharField(max_length=36)
repo_id = models.CharField(max_length=36, db_index=True)
path = models.TextField()
is_dir = models.BooleanField()

View File

@@ -688,7 +688,10 @@ def star_file(email, repo_id, path, is_dir, org_id=-1):
repo_id=repo_id,
path=path,
is_dir=is_dir)
f.save()
try:
f.save()
except IntegrityError, e:
logger.warn(e)
def unstar_file(email, repo_id, path):
# Should use "get", but here we use "filter" to fix the bug caused by no