Commits

magicrebirth committed 3e1fd66 Draft

Added full date to hyperlinks

  • Participants
  • Parent commits 9cf5ce3

Comments (0)

Files changed (11)

 	""" Form used in the <addonthespot> view """
 	class Meta:
 		model = HyperLink
-		fields = ('name', 'url', 'category', 'topic', 'year', 'desc',  )
+		fields = ('name', 'url', 'category', 'topic', 'desc',  'year', 'datefull')
 		widgets = {
 				'name': TextInput(attrs={'size': 60,}),
 				'url': TextInput(attrs={'size': 60,}),
+				'datefull': SelectDateWidget(),
 			}
 
 
 	url = models.URLField(blank=True, verify_exists=True)
 	desc = models.TextField(blank=True, verbose_name="desc")
 	year = models.IntegerField(blank=True, null=True)
+	datefull = models.DateField(auto_now_add=False, null=True, blank=True, verbose_name="full date",)
 	category = models.CharField(max_length=1, choices=CATEGORY_CHOICES)
 	topic = models.ForeignKey('Topic', null=True, blank=True, )
 
 	class Admin(admin.ModelAdmin):
-		list_display = ('id', 'updated_at', 'category', 'name', 'topic', 'year', 'url', )
+		list_display = ('id', 'updated_at', 'category', 'name', 'topic', 'datefull', 'url', )
 		search_fields = ['id']
-		list_filter = ('updated_at', 'category', 'topic', 'year')
-		list_editable = ['name', 'topic', 'url', 'year']
+		list_filter = ('updated_at', 'category', 'topic', 'year', 'datefull')
+		list_editable = ['name', 'topic', 'datefull']
 		fieldsets = [
 			('Administration',	
 				{'fields':	
 				}),
 			('',	
 				{'fields':	
-					['category', 'name', 'url',	 'topic', 'desc', 'year', ],	 
+					['category', 'name', 'url',	 'topic', 'desc', 'year', 'datefull' ],	 
 				}),
 			]
 			
+
+
 LiNa is a Link Navigator app for django [https://www.djangoproject.com/].
 
 Very simple: save some hyperlinks, give them a category and (if you want) a topic, using django's built-in admin interface.
 
 LiNa will create a webpage for each category you added. Each page presents all the links in that category using a simple html template that will let you navigate through them more quickly.
 
------------------------------------------
-
-An example is available here:  [www.michelepasin.org/demos/lina]
 
 
 -----------------------------------------
 
+An example is available here:  [http://demos.michelepasin.org/lina/]
+
+
+-----------------------------------------
+
+Installation:
+
+Just add the app to your installed apps settings. 
+
+Wire it up in urls.py, eg:
+
+(r'^lina/', include('lina.urls')),
+
+
+
+
 Changelog:
 
 
+2012-06-07
+* modified model of Hyperlink: added a datefull field
+ALTER TABLE `lina_hyperlink` add `datefull` date;
+
+
+
 2012-04-17
 * integrated a new html template, without frames
 

static/lina/bookmarklet.js

 // EXAMPLE OF THE JS USED FOR CREATING THE BOOKMARLET
 
 
-// crunch the following using <http://ted.mielczarek.org/code/mozilla/bookmarklet.html>
+// Crunch the following using <http://ted.mielczarek.org/code/mozilla/bookmarklet.html>
 // then you can use it as a bookmarklet that avoids the popup error
 // 
 
 
 javascript:(function(){
 	// change this depending on your installation urls
-	var POPUP_URL = "http://demos.michelepasin.org/lina/addonthespot/"; 
+	var POPUP_URL = "http://127.0.0.1:8000/lina/addonthespot/"; 
 	// get the currently selected text
 	 var text;
 	 try {
 
 then you can make it available like this:
 
-		// <p>Save the bookmarklet: <a style="background: red; color:white;" href="javascript:(function()%7Bjavascript:(function()%7Bvar%20POPUP_URL=%22http://demos.michelepasin.org/lina/addonthespot/%22;var%20text;try%7Btext=((window.getSelection&&window.getSelection())%7C%7C(document.getSelection&&document.getSelection())%7C%7C(document.selection&&document.selection.createRange&&document.selection.createRange().text));%7Dcatch(e)%7Btext=%22%22;%7Dvar%20url=encodeURIComponent(location.href);var%20title=encodeURIComponent(document.title);window.open(POPUP_URL+%22?sense=%22+text+%22&url=%22+url+%22&title=%22+title,%22myWindow%22,%22status%20=%201,%20height%20=%20500,%20width%20=%20850,%20resizable%20=%200%22);%7D)();%7D)();">Add to LiNa</a> (log in required!)
+		// <p>Save the bookmarklet: <a style="background: red; color:white;" href="javascript:(function()%7Bjavascript:(function()%7Bvar%20POPUP_URL=%22http://127.0.0.1:8000/lina/addonthespot/%22;var%20text;try%7Btext=((window.getSelection&&window.getSelection())%7C%7C(document.getSelection&&document.getSelection())%7C%7C(document.selection&&document.selection.createRange&&document.selection.createRange().text));%7Dcatch(e)%7Btext=%22%22;%7Dvar%20url=encodeURIComponent(location.href);var%20title=encodeURIComponent(document.title);window.open(POPUP_URL+%22?sense=%22+text+%22&url=%22+url+%22&title=%22+title,%22myWindow%22,%22status%20=%201,%20height%20=%20500,%20width%20=%20850,%20resizable%20=%200%22);%7D)();%7D)();">Add to LiNa</a> (log in required!)

templates/_lina_previous/addonthespot.html

-
-<html>
-	<head>
-	
-		{% if form %}
-
-			<title>{{pagetitle|default:"Add a new Hyperlink"}}</title>
-
-		{% else %}
-		
-			<title>Success!</title>
-			
-		{% endif %}
-
-
-
-
-	</head>
-
-
-	<body>
-
-
-
-	{% block header %}
-		<h1>
-			{% if form %}
-				Add new Hyperlink:
-			{% else %}
-				Added: <span class=" smallheader">"{{item.name|capfirst}}"</span>
-			{% endif %}
-		</h1>	
-	{% endblock %}	
-
-
-
-{% block maincontent %}
-
-	
-	{% if form %}
-		
-		
-		<form class="add" action="" method="post">{% csrf_token %}
-
-		    {% for field in form %}
-		        <div class="fieldWrapper">
-		            {{ field.errors }}
-		            {{ field.label_tag }}: 
-					<div class="fieldbox" style="margin-left:30px;">{{ field }}</div>
-		        </div>
-		    {% endfor %}
-		
-		    <input type="submit" value="Submit" class="submit_button" />
-		</form>
-		
-		<br />
-		
-		<hr>
-		
-		
-	{% else %}
-	
-		<input type="submit" value="Close this window" class="submit_button" onClick="javascript:self.close();return false;"/>
-		
-
-				
-	{% endif %}
-	
-	
-			
-{% endblock %}
-
-</body>
-
-</html>

templates/_lina_previous/frame_a.html

-<head>
-	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
-	<title>here's home</title>
-	
-	<style type="text/css" media="screen">
-		body {background: lightgray;}
-		a {color: blue;}
-		a:hover {color: white; background:blue; }
-		
-		#thelinks a {color: blue;}
-		#thelinks a:hover {color: yellow; background:rosyBrown;}
-	</style>
-	
-</head>
-
-<body id="index" onload="">
-<small><a href="{{subpath}}/lina" target="_parent">back</a></small>&nbsp;&nbsp;
-<small><a href="{% if randomitem %}{{ randomitem.url }}{% endif %}" target="showframe">random</a></small>
-<h2>{{category|upper}}</h2>
-
-<div id="thelinks">
-{% if items %}
-	{% if orderbydate %}
-		{% for i in items  %}
-			{% ifchanged %}<h4>{{ i.year|default:'Undated' }}</h4>{% endifchanged %}	
-			<li><a href="{{i.url}}" target="showframe">{{i.name}}</a></li>
-		{% endfor %}		
-	{% else %}
-		{% for i in items  %}
-			{% ifchanged %}<h4>{{ i.topic.name|capfirst|default:'unclassified' }}</h4>{% endifchanged %}	
-			<li><a href="{{i.url}}" target="showframe">{{i.name}}</a></li>
-		{% endfor %}
-	{% endif %}
-
-
-{% else %}
-	<p>Sorry no links available!</p>
-{% endif %}
-</div>
-
-
-
-<p>&nbsp;</p>
-<p>&nbsp;</p>
-
-</body>

templates/_lina_previous/frame_b.html

Empty file removed.

templates/_lina_previous/framebase.html

-<html>
-
-<frameset cols="20%,80%">
-
-  <frame src="frame_a" />
-  <frame src="frame_b" name="showframe" />
-
-</frameset>
-
-</html>

templates/_lina_previous/main.html

-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd"> 
-<html> 
-<head> 
-   	<title>LINA: a LInks NAvigator app for django</title> 
-   	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
-	<style type="text/css" media="screen">
-		body {background: lavender;}
-		a {color: blue;}
-		a.link2 {color: darkblue;}
-		a:hover {color: white; background:blue;}
-	</style>
-	
-</head> 
-<body> 
-
-<img src="http://farm8.staticflickr.com/7193/6935386089_e2a6eec9bc_m.jpg" width="203" height="240" alt="LiNa">
-
-<p style='font-size:20px;'><strong>LiNa</strong> is a Link Navigator app for <a class="link2" href="https://www.djangoproject.com/">Django</a>.</p> 
-<p style='font-size:20px;'>Very simple: save some hyperlinks, give them a category and (if you want) a topic. All done using django's built-in admin interface (ps: included there's also a bookmarklet that lets you save links while you browse the web).</p>
-<p style='font-size:20px;'>LiNa will create a webpage for each category you added. Each page presents all the links in that category using a frame-based view that will let you explore the links more quickly. </p> 
-
-<p>&nbsp;</p>
-<h2>Example of Categories</h2> 
-
-<div style="padding: 10px; font-size:20px;">{% for c in categories  %}
-	<li><a href="{{c|lower}}">{{c}}</a></li>
-{% endfor %}
-</div>
-
-<p style='font-size:20px;'>This is stuff I check periodically as part of my normal activities. Nothing too personal, so you're free to make use of it if you like.</p> 
-
-<p>&nbsp;</p>
-<h2>Can I add my own hyperlinks here?</h2> 
-
-<p style='font-size:20px;'>I'm afraid not.</p>
-<p style='font-size:20px;'>The simple reason is that I won't be able to guarantee hosting for this service in the future. And you don't want to lose your data, I guess.</p> 
-<p style='font-size:20px;'>However, if you're familiar with <a class="link2" href="http://www.djangoproject.com/">Django</a> you can <a class="link2" href="http://bitbucket.org/magicrebirth/lina">download the source code</a> and host the application yourself.</p>
-
-<p>&nbsp;</p>
-<h2>What kind of data do you store, exactly?</h2> 
-
-<p style='font-size:20px;'>Very little. There are just two tables: 'hyperlink' and 'topic'.</p>
-<p style='font-size:20px;'>The 'category' is actually a data structure defined in python, using the 'choices' data field available in django. So if you want to add new topics you have to do it in the source code (I figured that won't happen very often - at least in my case).</p>
-<p style='font-size:20px;'>Here's a graph:</p>
-<img src="http://farm8.staticflickr.com/7193/6848241107_8c82ddbb47.jpg" width="479" height="500" alt="LiNa model">
-
-<div id="footer">
-	
-	<p></p>
-
-
-	<br /><br />	
-	
-</div>
-
- 
- {#  GOOGLE STATS [activate once online]:  #}	
-
-<script type="text/javascript">
-
-  var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-2000254-3']);
-  _gaq.push(['_trackPageview']);
-
-  (function() {
-    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-  })();
-
-</script>	
-
-
-
-{#  END OF GOOGLE STATS [activate once online]:  #}
-</body>
-</html> 

templates/lina/linkslist.html

 
 <head>
 	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
-	<title>here's home</title>
+	<title>{{category|capfirst}} Links</title>
 	
 	<style type="text/css" media="screen">
 	/*

templates/lina/main.html

 <img src="http://farm8.staticflickr.com/7193/6935386089_e2a6eec9bc_m.jpg" width="203" height="240" alt="LiNa">
 
 <p style='font-size:20px;'><strong>LiNa</strong> is a Link Navigator app for <a class="link2" href="https://www.djangoproject.com/">Django</a>.</p> 
-<p style='font-size:20px;'>Very simple: save some hyperlinks, give them a category and (if you want) a topic. All done using django's built-in admin interface (ps: included there's also a bookmarklet that lets you save links while you browse the web).</p>
+<p style='font-size:20px;'>Very simple: save some hyperlinks, give them a category and (if you want) a topic. All done using django's built-in admin interface (ps: included there's also a bookmarklet that lets you save links while you browse the web): <p>Save the bookmarklet: <a style="background: red; color:white;" href="javascript:(function()%7Bjavascript:(function()%7Bvar%20POPUP_URL=%22http://127.0.0.1:8000/lina/addonthespot/%22;var%20text;try%7Btext=((window.getSelection&&window.getSelection())%7C%7C(document.getSelection&&document.getSelection())%7C%7C(document.selection&&document.selection.createRange&&document.selection.createRange().text));%7Dcatch(e)%7Btext=%22%22;%7Dvar%20url=encodeURIComponent(location.href);var%20title=encodeURIComponent(document.title);window.open(POPUP_URL+%22?sense=%22+text+%22&url=%22+url+%22&title=%22+title,%22myWindow%22,%22status%20=%201,%20height%20=%20500,%20width%20=%20850,%20resizable%20=%200%22);%7D)();%7D)();">Add to LiNa</a> (log in required!)</p>
 <p style='font-size:20px;'>LiNa will create a webpage for each category you added. Each page presents all the links in that category using a frame-based view that will let you explore the links more quickly. </p> 
 
 <p>&nbsp;</p>