These are chat archives for django/django

Jan 2016
Jan 18 2016 02:55
Howdy everyone. I have a database containing categories. I used djangogirls to create a blog, but I am having some trouble linking blog posts to a specific category. After submitting my blogform, I get the error 'page not found'. Would someone be willing to look at my code for me and point me in the right direction? I am not sure what I've done wrong.
Peter Bittner
Jan 18 2016 12:45
@drjsoundsgood Push your code to a public repository and paste the URL here. You get a 404, but is this related to your submission action? A stacktrace in addition would be helpful. -- I'd suggest, as I said, push the code to a repo, then open an issue about this problem in the same repo and post the link here.
Job Matheka
Jan 18 2016 15:24
Hey everyone, I am new to django and I have a question so bare with me, I have a web app that has two types of users a developer and an employer, so in django I know they are both users, here is my problem, when a developer is logged in they are also able to just be employers automatically but what I want is for a developer to be just a developer and an employer to be just an employer, if either wants to be something more they should be required to login/register a fresh, so how do I achieve this??.. I know My question is long hope it makes sense.
Shobhit Mittal
Jan 18 2016 15:41
@jobm i think u can set permission in user table for both.
Job Matheka
Jan 18 2016 15:48
Okay... So I'll do it via my python code or admin?
Jan 18 2016 22:32

my task is to create on main page of my web site two list one list for my post and second list categories titles which belong my post. i create that and work fine,and i create post details connect and again work fine. but i cant to work category details if i want to see list from my post which belong specific category i cant show me error page not found.

my code

my model

class Category(models.Model):
categorytitle =models.CharField(max_length=1,choices=CAT_CHOICES,unique=True)
slug= models.SlugField()

class Posts(models.Model):
Title = models.CharField(max_length=100,blank=True)
slug= models.SlugField()
category = models.ManyToManyField(Category)
my view category

def view_category(request, slug):
category = get_object_or_404(Category, slug=slug)
return render_to_response('blog/view_category.html', {
'category': category,
'posts': Posts.objects.filter(category=category)
my urls category

url(r'^(?P<slug>[^.]+)/$', views.view_category, name='view_category'),

Jan 18 2016 22:58
{% for category in categories %}
<li><a href="{{ category.slug }}">{{ category.categorytitle }}</a></li>
{% endfor %}
Jan 18 2016 23:20
Hello everyone and @bittner I've pushed my code to git and have opened up an issue: drjsoundsgood/PP#2 I've been playing around with things and I think I have just made a mess of things. When I try to add a post to a category, nothing happens (ie I submit the form but nothing gets saved to the category page, or to my admin interface). Can someone help me out with that?
Jan 18 2016 23:50
I figured out one of the errors raised about half an hour ago (I used a GET instead of POST) but the problem of getting a post to be displayed under its respective category still remains. drjsoundsgood/PP#2