Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新我很會頁面詞條排序 #171

Closed
wants to merge 4 commits into from
Closed

更新我很會頁面詞條排序 #171

wants to merge 4 commits into from

Conversation

chairco
Copy link
Contributor

@chairco chairco commented Oct 15, 2016

做法是先當查詢時,如果存在會先刪除原先詞條在產生一次就會更新 pk,排序就會往前。

@coveralls
Copy link

coveralls commented Oct 15, 2016

Coverage Status

Coverage decreased (-0.2%) to 94.02% when pulling 0e99394 on chairco:master into b4f39ae on sih4sing5hong5:master.

@coveralls
Copy link

coveralls commented Oct 15, 2016

Coverage Status

Coverage decreased (-0.2%) to 94.02% when pulling e032c6f on chairco:master into b4f39ae on sih4sing5hong5:master.

@sih4sing5hong5
Copy link
Collaborator

外語詞條底下可能有臺語文本詞條
用刪的會把別人提供的臺語一起刪掉

平臺項目加個timestamp會不會比較好?

@chairco
Copy link
Contributor Author

chairco commented Oct 16, 2016

timestamp 排序是最好選擇,加在外語詞條下 OK?

@chairco chairco closed this Oct 16, 2016
@chairco chairco reopened this Oct 16, 2016
@chairco
Copy link
Contributor Author

chairco commented Oct 16, 2016

tai5-uan5_gian5-gi2_tsu1-liau7-khoo3

需要做更動如下測試才會過:

class 外語表(資料表):
    外語語言 = models.ForeignKey(語言腔口表, related_name='+')
    外語資料 = models.TextField(blank=False)
    保存時間 = models.DateTimeField(auto_now_add=True)

@sih4sing5hong5
Copy link
Collaborator

sih4sing5hong5 commented Oct 16, 2016

改在臺灣言語平臺/項目模型.py平臺項目表,就不用改另一個專案了

class 平臺項目表(models.Model):
    項目名 = '平臺項目'
    外語 = models.OneToOneField(外語表, null=True, related_name=項目名)
    影音 = models.OneToOneField(影音表, null=True, related_name=項目名)
    ...
    保存時間 = models.DateTimeField(auto_now_add=True)

filter.order_by('-保存時間', '-pk')跟著改成.order_by('-平臺項目.保存時間', '-pk')就OK了

看用途應該用auto_nowauto_now_add好?

@chairco
Copy link
Contributor Author

chairco commented Oct 17, 2016

@sih4sing5hong5 好,我修改後再重新發 PR。另外請問您,我在 平臺項目表 新增的 保存時間 發現沒辦法出現在 admin 管理介面,我剛剛看了一下不知道原因,是不是要在哪邊做設定呢?

@sih4sing5hong5
Copy link
Collaborator

python manage.py makemigrationspython manage.py migrate做了嘛是按呢喲?
你會當push起來,我鬥看

@sih4sing5hong5
Copy link
Collaborator

@chairco 我幫你加到這个專案矣
你會當push branch過來

@chairco
Copy link
Contributor Author

chairco commented Oct 17, 2016

@sih4sing5hong5 丟,兩項我隆做嘛是按呢喲。幫我看,多謝。

@chairco
Copy link
Contributor Author

chairco commented Oct 17, 2016

brach 細 chairco

@sih4sing5hong5
Copy link
Collaborator

auto_now本底就袂出現佇admin頁?
http://stackoverflow.com/a/6386240/3640653

@sih4sing5hong5
Copy link
Collaborator

#174

@chairco
Copy link
Contributor Author

chairco commented Oct 17, 2016

啊,我知道了! 都謝都謝,打自己的尻川。

@sih4sing5hong5
Copy link
Collaborator

咱攏佇 #174 討論好矣,這條我先關掉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants