logo
Tags down

shadow

Django admin - stackedInline single instance


By : adroitcode
Date : October 15 2020, 11:12 PM
I wish did fix the issue. I assume you're using FK field to connect user and profile? Try OneToOneField it should render just one inline in admin.
code :


Share : facebook icon twitter icon

django: admin.StackedInline show full name instead of user name


By : robotic_douchebag
Date : March 29 2020, 07:55 AM
should help you out i got it using formfield_for_manytomany and formfield_for_foreignkey i thought they could only be used in modeladmin, but it could also be used for StackedInline :)

Django admin StackedInline customisation


By : user2697283
Date : March 29 2020, 07:55 AM

Django: admin.StackedInline with no foreign key


By : TheGreatDomino
Date : March 29 2020, 07:55 AM
To fix the issue you can do Your inline has to have a foreign key to the model you want to include it in, i.e. your Ad needs a foreign key to your unit; that's the way it works. If you can't represent that relationship, then you can't use inlines. I'm not sure what can replicate this behaviour in the admin, but I don't think inlines fit the bill.
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin

Django Admin, missing id readonly field in StackedInline


By : Sam.L
Date : March 29 2020, 07:55 AM
will be helpful for those in need First check that the MyModel model has a foreign key to the model that in which it will be declared as inlines = [MyModel].
Something like that:
code :
# models.py

class Album(models.Model):
    # various fields here

class AutoId(models.Model):
    id = models.CharField(primary_key=True, max_length=10)
    album = models.ForeignKey(Album, blank=True, null=True)
    foo = models.CharField(max_length=12)


# admin.py

class AutoIdInline(admin.StackedInline):
    model = AutoId
    fields = ('id', 'foo', )
    readonly_fields = ('id', 'foo', )

@admin.register(Album)
class AlbumAdmin(admin.ModelAdmin):
    inlines = [AutoIdInline]

Django admin StackedInline in custom tab


By : hattonS
Date : March 29 2020, 07:55 AM
Any of those help I found that django-baton template does support custom form tab and i managed to get 3 inlines in a single tab
https://django-baton.readthedocs.io/en/latest/form_tabs.html
code :
inlines = [
    UserKycInline, UserWalletInline, UserBankInline, CardBindingInline, TopUpsInline, TransfersInline, WithdrawalsInline,
]

fieldsets = (
    ('General', {
        'fields': ('id', 'uid', 'phone_number', 'nickname', 'status', 'eth_address', 'evt_address', 'created', 'modified',),
        'classes': ('baton-tabs-init', 'baton-tab-group-fs-kyc--inline-userkyc', 'baton-tab-group-fs-wallets--inline-user_wallet', 'baton-tab-group-fs-banks--inline-user_bank', 'baton-tab-group-fs-cards--inline-user_binding', 'baton-tab-group-fs-transactions--inline-user_toptup--inline-transfers--inline-user_transfer--inline-user_withdrawal', ),
    }),
    ('KYC', {
        'fields': (),
        'classes': ('tab-fs-kyc', ),
    }),
    ('WALLETS', {
        'fields': (),
        'classes': ('tab-fs-wallets', ),
    }),
    ('BANKS', {
        'fields': (),
        'classes': ('tab-fs-banks', ),
    }),
    ('CARDS', {
        'fields': (),
        'classes': ('tab-fs-cards', ),
    }),
    ('Transactions', {
        'fields': (),
        'classes': ('tab-fs-transactions', ),
    }),
)
Related Posts Related Posts :
  • Are django sessisons safe to use for mission critical signup forms?
  • Django Admin: Path to file uploaded is wrong. Missing "static"?
  • define the queryset of ModelMultipleChoiceField in the widget
  • My Django manytomany fields are all marked unique, is there an option to remove this?
  • Django flatpages raising 404 when DEBUG is False (404 and 500 templates exist)
  • Django problem with extends template tag
  • Limit Django's inlineformset_factory to only create new objects
  • Django edit and delete from front end
  • Explanation of contribute_to_class
  • Dynamically Delete inline formsets in Django
  • Forward a copy of http requests to another (test) environment
  • How do I access the request from the request_finished signal callback?
  • django: Call to remote service kills python
  • which is the best django study book
  • Using a Non-Default Manager with GenericForeignKey()
  • Adding a link on the Django Admin frontpage
  • How to force select_related() to select ForeignKeys that have null=True attribute?
  • how to make certain that the queryset will be ordered by a valid field - django
  • Django: Filtering on a ("latitude, longitude") field
  • Search engine solution for Django that actually works?
  • Creating a db driven primary navigation in django?
  • Simulating Google Appengine's Task Queue with Gearman
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org