Hi Jani! Am Sonntag, 18. Juni 2017 11:05:27 UTC+2 schrieb Jani Tiainen: > > Hi, > > Seems that you've on right track. Just don't chew up too big bites. >
Thanks! Good to know that I'm not completely wrong :-) > I suggest that first you start mapping your real world ideas to models. > Don't worry if you don't get it right at first try thats why migrations do > exist. > That's where the first problem starts. Like I said I'm not that much familiar with database stuff. Also test driven development model could work nicely. > That doesn't tell me anything :-( I know what test driven development is, but don't understand the context with this. > Most of the things you describe are clienside operations and Django being > agnostic for that you're free to implement clientside as you wish. > > You probably won't find much for similar project but there might be > solutions to individual problems. > Sadly in that example (http://blog.e-shell.org/130) it's not clear what to put where. Maybe you can help me with that. class Project(models.Model): > name = models.CharField('Name of the project', max_length=100) > code = models.CharField('Code number of the project', max_length=10) > creator = models.ForeignKey(User, related_name='created_projects') > maintainer = models.ManyToManyField(User, > related_name='maintained_projects') > > That's easy: polls\models.py which starts with > from django.db import models > from django.contrib.auth.models import User > ("User" because of creator and maintainer) But polls\forms.py is change several times. > #from myproject.myapp.models import Projectfrom .models import Project > > class ProjectForm(forms.ModelForm): > class Meta: > model = Proyecto > > Then > #from myproject.myapp.models import Project > > from .models import Projectfrom django.contrib.auth.models import Group > class ProjectForm(forms.ModelForm): > > creator_choices = [(c.id, c.username) for c in > Group.objects.get(name__icontains='creator').user_set.all()] > maintainer_choices = [(m.id, m.username) for m in > Group.objects.get(name__icontains='maintainer').user_set.all()] > > creator = forms.ChoiceField(required=True, label='Project creator', > choices=creator_choices) > maintainer = forms.MultipleChoiceField(required=True, label='Project > maintainer(s)', choices=maintainer_choices) > > class Meta: > model = Proyecto > > And then > #from myproject.myapp.forms import ProjectForm > > from .forms import ProjectFormfrom django.contrib.auth.models import Group > creator_choices = [(c.id, c.username) for c in > Group.objects.get(name__icontains='creator').user_set.all()]maintainer_choices > = [(m.id, m.username) for m in > Group.objects.get(name__icontains='maintainer').user_set.all()] > creator = forms.ChoiceField(required=True, label='Project creator', > choices=creator_choices)maintainer = forms.MultipleChoiceField(required=True, > label='Project maintainer(s)', choices=maintainer_choices) > myform = ProjectForm() > myform.fields['creator'].choices = > creator_choicesmyform.fields['maintainer'].choices = maintainer_choices > > But here's "import ProjectForm" instead of import "Project" and "class Meta" is missing. Can you tell me what I did wrong? python manage.py makemigrations <https://docs.djangoproject.com/en/1.11/ref/django-admin/#django-admin-makemigrations> always can't find something (project, ProjectForm, ...), no matter what I'm trying to change to resolve that error. I'm completely confused :-( Thank you! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/91a2c682-a360-49a5-80ad-d287da0e30e6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

