forked from 0x2620/pandora
remove text/news, now in news
This commit is contained in:
parent
2308279801
commit
ab581b79f6
3 changed files with 1 additions and 58 deletions
|
@ -14,7 +14,7 @@ class News(models.Model):
|
||||||
|
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
modified = models.DateTimeField(auto_now=True)
|
modified = models.DateTimeField(auto_now=True)
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User, related_name='news')
|
||||||
|
|
||||||
title = models.TextField()
|
title = models.TextField()
|
||||||
content = models.TextField()
|
content = models.TextField()
|
||||||
|
|
|
@ -7,24 +7,6 @@ from django.db import models
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
|
||||||
class News(models.Model):
|
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
|
||||||
modified = models.DateTimeField(auto_now=True)
|
|
||||||
published = models.DateTimeField(default=datetime.now, editable=False)
|
|
||||||
public = models.BooleanField(default=False)
|
|
||||||
|
|
||||||
user = models.ForeignKey(User)
|
|
||||||
slug = models.SlugField()
|
|
||||||
title = models.CharField(null=True, max_length=255)
|
|
||||||
body = models.TextField(default='')
|
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
return u"%s <%s>" % (self.title, self.slug)
|
|
||||||
|
|
||||||
def get_absolute_url(self):
|
|
||||||
return '/text/%s' % self.slug
|
|
||||||
|
|
||||||
|
|
||||||
class Text(models.Model):
|
class Text(models.Model):
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
modified = models.DateTimeField(auto_now=True)
|
modified = models.DateTimeField(auto_now=True)
|
||||||
|
|
|
@ -11,45 +11,6 @@ import models
|
||||||
from api.actions import actions
|
from api.actions import actions
|
||||||
|
|
||||||
|
|
||||||
def getNews(request):
|
|
||||||
'''
|
|
||||||
param data
|
|
||||||
string id
|
|
||||||
|
|
||||||
return page
|
|
||||||
'''
|
|
||||||
response = json_response({})
|
|
||||||
itemId = json.loads(request.POST['data'])
|
|
||||||
item = get_object_or_404_json(models.News, pk=itemId)
|
|
||||||
response['data']['page'] = item.html()
|
|
||||||
return render_to_json_response(response)
|
|
||||||
actions.register(getNews)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required_json
|
|
||||||
def editNews(request):
|
|
||||||
'''
|
|
||||||
param data
|
|
||||||
string id
|
|
||||||
|
|
||||||
return page
|
|
||||||
'''
|
|
||||||
response = json_response({})
|
|
||||||
itemId = json.loads(request.POST['data'])
|
|
||||||
item = get_object_or_404_json(models.Text, pk=itemId)
|
|
||||||
response['data']['page'] = item.html()
|
|
||||||
return render_to_json_response(response)
|
|
||||||
actions.register(editNews, cache=False)
|
|
||||||
|
|
||||||
|
|
||||||
def findNews(request):
|
|
||||||
'''
|
|
||||||
'''
|
|
||||||
response = json_response({})
|
|
||||||
return render_to_json_response(response)
|
|
||||||
actions.register(findNews)
|
|
||||||
|
|
||||||
|
|
||||||
def getText(request):
|
def getText(request):
|
||||||
'''
|
'''
|
||||||
param data
|
param data
|
||||||
|
|
Loading…
Reference in a new issue