objtrack. ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Other/Proprietary Li...
- °Ô½ÃÀÚ À̸§:
- David Cramer
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://code.google.com/u/dcramer/
objtrack. ű×
objtrack. ¼³¸í
Django °³Ã¼º¸±â ÃßÀû objtrackÀº ÀÏ¹Ý °´Ã¼º¸±â ÃßÀû ¸ðµ¨ÀÔ´Ï´Ù.ÀÌ ³¯Â¥ ÀÌÈĺÎÅÍ "º¯°æµÈ ¸ðµç °Í"À̶ó´Â "¸¶Áö¸·À¸·Î º» ³¯Â¥"¸¦ ÀúÀåÇÕ´Ï´Ù. ¶ÇÇÑ Date.Installation : Distutils¸¦ »ç¿ëÇÏ¿© ÆÐÅ°Áö¸¦ ´Ù¿î·ÎµåÇÏ°í ¼³Ä¡ÇÏ´Â ±âº» Å° ¸ñ·ÏÀ» ÀúÀåÇÕ´Ï´Ù. Distutils¸¦ »ç¿ëÇÏ¿© ÆÐÅ°Áö¸¦ ´Ù¿î·ÎµåÇÏ°í ¼³Ä¡ÇϽʽÿÀ. PIP ¼³Ä¡ objtrackupdate ¼³Ä¡ ¹× ¼³Ä¡µÈ ¾Û ¼³Á¤À» Ãß°¡ÇϽʽÿÀ. installed_apps = ( 'django.contrib.admin) ','django.contrib.auth ','django.contrib.contenttypes ','django.contrib.sessions ','objtrack ',) ¸¶Áö¸·À¸·Î python manage.py syncdb¸¦ ½ÇÇàÇÏ¿© µ¥ÀÌÅͺ£À̽º Å×À̺íÀ» ÀÛ¼ºÇϽʽÿÀ. ½Åû : Æ÷·³ Ç¥½Ã »õ·Î¿î °Ô½Ã¹°ÀÌ ÀÖ½À´Ï´Ù. objtrack.models¿¡¼ objecttrackerdef °¡Á® ¿À±â view_forum_list (¿äû) : categories = object.objects.all () tracking = objecttracker.objects.get_for_request (¿äû, ½º·¹µå) # ¾ÆÁ÷µµ ³¯Â¥¸¦ ¾÷µ¥ÀÌÆ®ÇؾßÇÕ´Ï´Ù ÀØÁö ¸¶¼¼¿ä. »õ ½º·¹µå #°¡ Æ÷·³¿¡ Ãß°¡ µÉ ¶§ Çʵå. Ä«Å×°í¸®ÀÇ ¹üÁÖÀÇ °æ¿ì : category.has_new_posts = tracking.has_viewed (Category) # ÀÌÁ¦ ¸ðµç Æ÷·³À» "ÀÌ"·Î Ç¥½ÃÇÏ°í ½Í½À´Ï±î? tracking.mark_all_as_viewed () ¸®ÅÏ ·»´õ¸µ (...) ½º·¹µå ¸ñ·ÏÀÇ ½º·¹µå¿¡ has_viewed ¼Ó¼º Ãß°¡ : def view_thread_list (¿äû) : threads = thread.objects.all () tracking = objecttracker.objects.get_for_request (¿äû, ½º·¹µå) # ÀÌ°ÍÀº * ÃÖÀû * È®ÀÎÀ» È®ÀÎÇÏ´Â °ÍÀÌ ¾Æ´ÏÁö¸¸ ½º·¹µå¿¡¼ ½º·¹µå¿¡¼ ÀÛµ¿ÇÕ´Ï´Ù. thread.has_viewed = tracking.has_viewed (thread) ¸®ÅÏ ·»´õ¸µ (...) thread °´Ã¼¸¦ Ç¥½Ã ÇÒ ¶§ ÀÐÀ» ¶§ º¸±â : def view_thread (¿äû, thread_id) : thread = thread.objects.get (pk = threas_id) tracking = objecttracker.objects.get_for_request (¿äû, ½º·¹µå) tracking.mark_as_view (½º·¹µå) ¸®ÅÏ ·»´õ¸µ (...) Coffin ¶Ç´Â Django ÅÛÇø®Æ® ³»¿¡¼ »ç¿ëÇϽʽÿÀ. {%·Îµå Æ®·¡Å· %} {%·Îµå Æ®·¡Å· %} {queryset | with_tracking : "date_fielt"%} ... {% endfor %} ¿ä±¸ »çÇ× : ¡¤ ÆÄÀ̽㠡¤ Àå°í
objtrack. °ü·Ã ¼ÒÇÁÆ®¿þ¾î