add notes everywhere
This commit is contained in:
parent
0d4aba4b4b
commit
ab4e151f84
|
@ -24,7 +24,7 @@ def splitSearch(string):
|
||||||
def get_real_ctype(module_name):
|
def get_real_ctype(module_name):
|
||||||
for c in ContentType.objects.filter(model=module_name):
|
for c in ContentType.objects.filter(model=module_name):
|
||||||
try:
|
try:
|
||||||
if c.model_class().is_itf_model == True:
|
if c.model_class() is not None:
|
||||||
return c
|
return c
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -80,6 +80,7 @@ class ItfModel(models.Model):
|
||||||
|
|
||||||
|
|
||||||
def add_note(self, user, text):
|
def add_note(self, user, text):
|
||||||
|
from itfprofiles.models import Note
|
||||||
if self.user_has_perms(user):
|
if self.user_has_perms(user):
|
||||||
n = Note(user=user, text=text, content_object=self)
|
n = Note(user=user, text=text, content_object=self)
|
||||||
n.save()
|
n.save()
|
||||||
|
@ -113,7 +114,7 @@ class ItfModel(models.Model):
|
||||||
# d['add_form'] = self.__class__.get_add_form()
|
# d['add_form'] = self.__class__.get_add_form()
|
||||||
d['forms'] = self.__class__.get_forms()
|
d['forms'] = self.__class__.get_forms()
|
||||||
d['obj'] = self
|
d['obj'] = self
|
||||||
d['content_type'] = ContentType.objects.filter(model=self.__class__._meta.module_name)[0]
|
d['content_type'] = self.get_content_type()
|
||||||
try:
|
try:
|
||||||
edit_url = self.get_edit_url()
|
edit_url = self.get_edit_url()
|
||||||
d['edit_url'] = edit_url
|
d['edit_url'] = edit_url
|
||||||
|
@ -122,6 +123,11 @@ class ItfModel(models.Model):
|
||||||
pass
|
pass
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
def get_content_type(self):
|
||||||
|
for c in ContentType.objects.filter(model=self.__class__._meta.module_name):
|
||||||
|
if c.model_class() is not None:
|
||||||
|
return c
|
||||||
|
raise
|
||||||
|
|
||||||
def get_gallery_image(self):
|
def get_gallery_image(self):
|
||||||
from mediagallery.models import Photo
|
from mediagallery.models import Photo
|
||||||
|
@ -246,34 +252,36 @@ class ItfModel(models.Model):
|
||||||
Get the main image thumbnail for this object - checks if object has either a field or custom method called 'main_image', then checks for default_images on the ModelExtra for this model.
|
Get the main image thumbnail for this object - checks if object has either a field or custom method called 'main_image', then checks for default_images on the ModelExtra for this model.
|
||||||
'''
|
'''
|
||||||
def get_main_image(self, size="142x150"):
|
def get_main_image(self, size="142x150"):
|
||||||
|
|
||||||
if hasattr(self, 'main_image'):
|
if hasattr(self, 'main_image'):
|
||||||
main_image_getter = self.main_image
|
main_image_getter = self.main_image
|
||||||
if type(main_image_getter).__name__ == 'instancemethod':
|
if type(main_image_getter).__name__ == 'instancemethod':
|
||||||
imgfield = main_image_getter()
|
imgfield = main_image_getter()
|
||||||
else:
|
else:
|
||||||
imgfield = main_image_getter
|
imgfield = main_image_getter
|
||||||
else:
|
else:
|
||||||
imgfield = self.get_modelextra().default_image #FIXME!!
|
imgfield = self.get_modelextra().default_image #FIXME!!
|
||||||
|
|
||||||
if imgfield is None or imgfield.name == '':
|
if imgfield is None or imgfield.name == '' and self.get_modelextra():
|
||||||
imgfield = self.get_modelextra().default_image
|
imgfield = self.get_modelextra().default_image
|
||||||
|
|
||||||
if imgfield:
|
if imgfield:
|
||||||
#try:
|
try:
|
||||||
thumb = get_thumbnail(imgfield, size, crop="center").url
|
thumb = get_thumbnail(imgfield, size, crop="center").url
|
||||||
#except:
|
except:
|
||||||
# print imgfield.url
|
thumb = self.get_placeholder(size)
|
||||||
# thumb = 'http://placehold.it/%s' % size
|
|
||||||
else:
|
else:
|
||||||
thumb = 'http://placehold.it/%s' % size # Add default image for site
|
thumb = self.get_placeholder(size) # Add default image for site
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'thumb': thumb
|
'thumb': thumb
|
||||||
}
|
}
|
||||||
|
|
||||||
'''
|
|
||||||
def main_image(self):
|
def get_placeholder(self, size):
|
||||||
return None
|
return 'http://placehold.it/%s' % size
|
||||||
'''
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
The templates for objects are stored following the convention templates/modules/<app_label>/<model_name>.html
|
The templates for objects are stored following the convention templates/modules/<app_label>/<model_name>.html
|
||||||
|
|
|
@ -183,7 +183,7 @@ def contact_group(request):
|
||||||
send_mail("Contact on theatreforum.in", message, frm, [to_email])
|
send_mail("Contact on theatreforum.in", message, frm, [to_email])
|
||||||
return HttpResponse("Your message has been sent, thanks.")
|
return HttpResponse("Your message has been sent, thanks.")
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
def add_note(request, content_type, object_id):
|
def add_note(request, content_type, object_id):
|
||||||
model_class = ContentType.objects.get(pk=content_type).model_class()
|
model_class = ContentType.objects.get(pk=content_type).model_class()
|
||||||
obj = model_class.objects.get(pk=object_id)
|
obj = model_class.objects.get(pk=object_id)
|
||||||
|
|
|
@ -4,7 +4,7 @@ from tagging.fields import TagField
|
||||||
from django.core.paginator import Paginator, InvalidPage, EmptyPage
|
from django.core.paginator import Paginator, InvalidPage, EmptyPage
|
||||||
from django.contrib.contenttypes import generic
|
from django.contrib.contenttypes import generic
|
||||||
from app.models import ItfModel
|
from app.models import ItfModel
|
||||||
from itfprofiles.models import TheatreGroup
|
from itfprofiles.models import TheatreGroup, Note
|
||||||
from mediagallery.models import GalleryAlbum
|
from mediagallery.models import GalleryAlbum
|
||||||
|
|
||||||
GENRES = (
|
GENRES = (
|
||||||
|
@ -47,6 +47,7 @@ class Script(ItfModel):
|
||||||
theatre_group = models.ForeignKey(TheatreGroup, help_text="Theatre Group, if any")
|
theatre_group = models.ForeignKey(TheatreGroup, help_text="Theatre Group, if any")
|
||||||
related_scripts = models.ManyToManyField("Script", through="ScriptScript", related_name='related_script')
|
related_scripts = models.ManyToManyField("Script", through="ScriptScript", related_name='related_script')
|
||||||
galleries = generic.GenericRelation(GalleryAlbum)
|
galleries = generic.GenericRelation(GalleryAlbum)
|
||||||
|
notes = generic.GenericRelation(Note)
|
||||||
# add_form = 'ScriptForm'
|
# add_form = 'ScriptForm'
|
||||||
|
|
||||||
#Meta
|
#Meta
|
||||||
|
|
|
@ -167,7 +167,7 @@ $(function() {
|
||||||
</div> <!-- end buzz -->
|
</div> <!-- end buzz -->
|
||||||
|
|
||||||
<div id="notes" class="tab_content">
|
<div id="notes" class="tab_content">
|
||||||
<h3 class="orange">Kindly refer to notes in script archive. But instead of Posted by Name, Date, Time, make it - date, time</h3>
|
{% include 'includes/notes.html' %}
|
||||||
</div> <!-- end notes -->
|
</div> <!-- end notes -->
|
||||||
|
|
||||||
<div id="contact" class="tab_content">
|
<div id="contact" class="tab_content">
|
||||||
|
|
|
@ -215,7 +215,7 @@ $(function() {
|
||||||
</div> <!-- end buzz -->
|
</div> <!-- end buzz -->
|
||||||
|
|
||||||
<div id="notes" class="tab_content">
|
<div id="notes" class="tab_content">
|
||||||
<h3 class="orange">Kindly refer to notes in script archive. But instead of Posted by Name, Date, Time, make it - date, time</h3>
|
{% include 'includes/notes.html' %}
|
||||||
</div> <!-- end notes -->
|
</div> <!-- end notes -->
|
||||||
|
|
||||||
<script type="text/javascript" src="/static/js/innertabs.js"></script>
|
<script type="text/javascript" src="/static/js/innertabs.js"></script>
|
||||||
|
|
|
@ -181,39 +181,7 @@ $(function() {
|
||||||
|
|
||||||
|
|
||||||
<div id="notes" class="tab_content">
|
<div id="notes" class="tab_content">
|
||||||
|
{% include 'includes/notes.html' %}
|
||||||
<div class="noteEach">
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam,
|
|
||||||
quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit
|
|
||||||
esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
|
|
||||||
dolore te feugait nulla facilisi.</p>
|
|
||||||
<p class="noteMetaData">- posted by Name, Date, Time</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="noteEach">
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam,
|
|
||||||
quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit
|
|
||||||
esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
|
|
||||||
dolore te feugait nulla facilisi.</p>
|
|
||||||
<p class="noteMetaData">- posted by Name, Date, Time</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="noteEach">
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam,
|
|
||||||
quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit
|
|
||||||
esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
|
|
||||||
dolore te feugait nulla facilisi.</p>
|
|
||||||
<p class="noteMetaData">- posted by Name, Date, Time</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="noteEach">
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam,
|
|
||||||
quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit
|
|
||||||
esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
|
|
||||||
dolore te feugait nulla facilisi.</p>
|
|
||||||
<p class="noteMetaData">- posted by Name, Date, Time</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div> <!-- end notes -->
|
</div> <!-- end notes -->
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user